diff options
Diffstat (limited to 'app/views/tournaments')
-rw-r--r-- | app/views/tournaments/_selected.html.erb | 22 | ||||
-rw-r--r-- | app/views/tournaments/index.html.erb | 11 | ||||
-rw-r--r-- | app/views/tournaments/join.html.erb | 2 | ||||
-rw-r--r-- | app/views/tournaments/new.html.erb | 15 | ||||
-rw-r--r-- | app/views/tournaments/show.html.erb | 21 |
5 files changed, 64 insertions, 7 deletions
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb new file mode 100644 index 0000000..925e127 --- /dev/null +++ b/app/views/tournaments/_selected.html.erb @@ -0,0 +1,22 @@ +<%= form_for(@tournament) do |f| %> + <%= render "common/error_messages", :target => @tournament %> + <%= f.hidden_field(:game_id) %> + + <% @chosen = Game.find_by(params[:game]) %> + <% @tournament.attributes.each do |name, value| %> + <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "statuss") %> + <% next %> + <% end %> + <p> + <%= f.label name %><br> + <% if !@chosen.attributes[name].nil? %> + <%= f.text_field(name, :value => @chosen.attributes[name] ) %> + <% else %> + <%= f.text_field name %> + <% end %> + + </p> + + <% end %> + <%= f.submit %> +<% end %> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index fb8b381..452d939 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -1,6 +1,7 @@ -<h1>Listing tournaments</h1> +<h1>Listing Tournaments</h1> -<table> +<% if @tournaments.length > 0 %> +<table class="table table-hover"> <thead> <tr> <th>Game</th> @@ -35,7 +36,9 @@ <% end %> </tbody> </table> - +<% else %> + <p class="no-entries"> No tournaments going on right now... Why not start your own? </p> +<% end %> <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/join.html.erb b/app/views/tournaments/join.html.erb new file mode 100644 index 0000000..1d38d68 --- /dev/null +++ b/app/views/tournaments/join.html.erb @@ -0,0 +1,2 @@ + <%= @user.name %> + diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index 2a60539..8c74068 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 btn-success btn-xs") %> +<% end %> + +<div id='ajax-form'> + <% if not @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 208c6f4..c3a40e7 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,5 +1,11 @@ -<p id="notice"><%= notice %></p> +<% if @tournament.joinable_by?(current_user) %> + <%= form_tag(tournament_path(@tournament), method: "put") do %> + <input type="hidden" name="update_action" value="join"> + <%= current_user.name %><%= submit_tag("Join") %> + <% end %> +<% end %> +<% if current_user.in_group?(:host) %> <p> <strong>Game:</strong> <%= @tournament.game %> @@ -40,5 +46,18 @@ <%= @tournament.randomized_teams %> </p> +<p> + <strong>Status:</strong> + <%= @tournament.status %> +</p> + +<%= form_tag(tournaments_path.to_s + "/" + @tournament.id.to_s + "/edit", method: "get") do %> + <input type="hidden" name="close_action" value="close"> + <%= submit_tag("Close Tournament Registration") %> +<% end %> + <%= link_to 'Edit', edit_tournament_path(@tournament) %> | <%= link_to 'Back', tournaments_path %> + +<% end %> + |