From aeda550c2ad04c9496a803b1d7f1d34a4566a9fe Mon Sep 17 00:00:00 2001 From: Tomer Kimia Date: Thu, 27 Mar 2014 16:40:35 -0400 Subject: New tournement start page --- app/assets/stylesheets/tournaments.css.scss | 30 +++++++ app/views/tournaments/show.html.erb | 116 +++++++++++++++------------- 2 files changed, 92 insertions(+), 54 deletions(-) diff --git a/app/assets/stylesheets/tournaments.css.scss b/app/assets/stylesheets/tournaments.css.scss index 458897e..eca4c7e 100644 --- a/app/assets/stylesheets/tournaments.css.scss +++ b/app/assets/stylesheets/tournaments.css.scss @@ -10,3 +10,33 @@ span.default-explanation { color: gray; font-style: italic; } + +#players-needed { + text-align: center; + font-style: italic; +} + +#tournament-side-params { + background: none repeat scroll 0 0 #ADD8E6; + border-radius: 5px; + float: right; + font-size: 7px; + padding: 10px; + + p { + font-size: 10px; + margin-bottom: 5px; + } + +} + +#tournament-users{ + + li { + color: green; + } + + .black { + color: black; + } +} \ No newline at end of file diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 1f24f39..acff3d4 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,75 +1,83 @@ -<% if @tournament.joinable_by?(current_user) %> - <%= form_tag(tournament_path(@tournament), method: "put") do %> - - <%= current_user.name %><%= submit_tag("Join") %> - <% end %> -<% end %> -
<%= tag("div", {:class => "progress-bar progress-bar-warning", :style => "width: " +(@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s + "%", "aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => (@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s, "role" => "progressbar"}) %> 60% Complete (warning)
-

<%= @tournament.players.count %> have signed up. <%= @tournament.min_players_per_team * @tournament.min_teams_per_match %> needed.

+

<%= pluralize(@tournament.players.count, "player has", "players have") %> signed up. <%= @tournament.min_players_per_team * @tournament.min_teams_per_match %> needed.

-<% if current_user.in_group?(:host) %> -

- Game: - <%= @tournament.id %> -

+
+

+ Game: + <%= @tournament.id %> +

-

- Status: - <%= @tournament.status %> -

+

+ Status: + <%= @tournament.status %> +

-

- Min players per team: - <%= @tournament.min_players_per_team %> -

+

+ Min players per team: + <%= @tournament.min_players_per_team %> +

-

- Max players per team: - <%= @tournament.max_players_per_team %> -

+

+ Max players per team: + <%= @tournament.max_players_per_team %> +

-

- Min teams per match: - <%= @tournament.min_teams_per_match %> -

+

+ Min teams per match: + <%= @tournament.min_teams_per_match %> +

-

- Max teams per match: - <%= @tournament.max_teams_per_match %> -

+

+ Max teams per match: + <%= @tournament.max_teams_per_match %> +

-

- Set rounds: - <%= @tournament.set_rounds %> -

+

+ Set rounds: + <%= @tournament.set_rounds %> +

-

- Randomized teams: - <%= @tournament.randomized_teams %> -

+

+ Randomized teams: + <%= @tournament.randomized_teams %> +

+
-

- Status: - <%= @tournament.status %> -

+<%# Show all players in the tournament %> +<% if @tournament.players.length > 0 %> + +<% end %> -<%= form_tag(tournaments_path.to_s + "/" + @tournament.id.to_s + "/edit", method: "get") do %> - - <% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %> - <%= submit_tag("Close Tournament Registration") %> - <% else %> - <%= submit_tag("Close Tournament Registration", disabled: true) %> +<%# If user can join, and user hasn't joined already, show the join tournment tag %> +<% if @tournament.joinable_by?(current_user) && !@tournament.players.include?(current_user) %> + <%= form_tag(tournament_path(@tournament), method: "put") do %> + + <%= submit_tag("Join Tournamnet") %> <% end %> <% end %> -<%= link_to 'Edit', edit_tournament_path(@tournament) %> | -<%= link_to 'Back', tournaments_path %> - +<%# If user is the host, let them start the tournment %> +<% if @tournament.hosts.include?(current_user) %> + <%= form_tag(tournaments_path.to_s + "/" + @tournament.id.to_s + "/edit", method: "get") do %> + + <% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %> + <%= submit_tag("Start Tournament") %> + <% else %> + <%= submit_tag("Start Tournament", disabled: true) %> + <% end %> +
+ <%= link_to 'Edit', edit_tournament_path(@tournament) %> | + <%= link_to 'Back', tournaments_path %> <% end %> +<%end %> + -- cgit v1.2.3-2-g168b