summaryrefslogtreecommitdiff
path: root/app/views/tournaments
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/tournaments')
-rw-r--r--app/views/tournaments/_selected.html.erb15
-rw-r--r--app/views/tournaments/index.html.erb2
-rw-r--r--app/views/tournaments/new.html.erb15
-rw-r--r--app/views/tournaments/show.html.erb6
4 files changed, 34 insertions, 4 deletions
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
new file mode 100644
index 0000000..551dc40
--- /dev/null
+++ b/app/views/tournaments/_selected.html.erb
@@ -0,0 +1,15 @@
+<%= form_for(@tournament) do |f| %>
+ <%= render "common/error_messages", :target => @tournament %>
+ <%= f.hidden_field(:game_id) %>
+
+ <% @tournament.attributes.each do |name, value| %>
+ <% if (name == "id") or (name =~ /.*_at$/) %>
+ <% next %>
+ <% end %>
+ <p>
+ <%= f.label name %><br>
+ <%= f.text_field name %>
+ </p>
+ <% end %>
+ <%= f.submit %>
+<% end %>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index dec16d1..3d54b8c 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -38,4 +38,4 @@
<br>
-<%= link_to 'New Tournament', new_tournament_path %>
+<%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning btn-lg" %>
diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb
index 2a60539..e007e31 100644
--- a/app/views/tournaments/new.html.erb
+++ b/app/views/tournaments/new.html.erb
@@ -1,5 +1,16 @@
-<h1>New tournament</h1>
+<h1>New Tournament</h1>
-<%= render 'form' %>
+<%= form_tag(new_tournament_path, method: "get") do %>
+ <%= select_tag('game',
+ options_from_collection_for_select(@games, 'id', 'name', @tournament.game.nil? || @tournament.game.id),
+ :prompt => "Select a Game Type") %>
+ <%= submit_tag("Select", :class => "btn-warning btn-lg") %>
+<% end %>
+
+<div id='ajax-form'>
+ <% unless @tournament.game.nil? %>
+ <%= render 'selected' %>
+ <% end %>
+</div>
<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index 355bc90..85ed026 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -1,4 +1,8 @@
-<p id="notice"><%= notice %></p>
+<% if @tournament.joinable_by?(current_user) %>
+ <%= form_tag(tournament_page(@tournament)+"/join", method: "get") do %>
+ <%= submit_tag("Join") %>
+ <% end %>
+<% end %>
<p>
<strong>Game:</strong>