From 4487d51e90f4e9c985d2fb235b7c0dce43cf0bc7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 28 Apr 2014 12:41:18 -0400 Subject: misc view cleanups --- app/views/common/_error_messages.html.erb | 2 +- app/views/teams/show.html.erb | 2 - app/views/tournaments/_form.html.erb | 2 +- app/views/tournaments/show.html.erb | 189 +++++++++++++++--------------- lib/sampling/peer_review.html.erb | 4 +- 5 files changed, 96 insertions(+), 103 deletions(-) diff --git a/app/views/common/_error_messages.html.erb b/app/views/common/_error_messages.html.erb index 731f62c..fdeaf65 100644 --- a/app/views/common/_error_messages.html.erb +++ b/app/views/common/_error_messages.html.erb @@ -1,6 +1,6 @@ <%# http://railscasts.com/episodes/211-validations-in-rails-3 %> <% if target.errors.any? %> -
+

<%= pluralize(target.errors.count, "error") %> prohibited this form from being submitted:

    <% target.errors.full_messages.each do |msg| %> diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb index 5b18d33..ab49d65 100644 --- a/app/views/teams/show.html.erb +++ b/app/views/teams/show.html.erb @@ -1,4 +1,2 @@ -

    <%= notice %>

    - <%= link_to 'Edit', edit_team_path(@team) %> | <%= link_to 'Back', teams_path %> diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 0937fd2..fdf36e8 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -1,7 +1,7 @@ <%= render "common/error_messages", :target => @tournament %>
    + Game type <%= form_for(@tournament, url: new_tournament_path, method: "get") do |f| %> - <%= render "common/error_messages", :target => @tournament %>

    <%= f.label :game_id, "Select a game type" %> <%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index ec83dc0..7e3fbae 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,109 +1,104 @@

    - <%= @tournament.name %> + <%= @tournament.name %>

    - <%= tag("div", {:id => "prog-bar", :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) -
    + <%# FIXME: What's up with this? Hardcoded 60%? %> + <%= tag("div", {:id => "prog-bar", :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) +
-

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

- - - -

- Status: - <% if @tournament.status == 0 %> - Waiting for players... - <% else %> - Started - <% end %> -

- -

- Name: - <%= @tournament.name %> -

- -

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

- -

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

- -

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

- -

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

-

- Scoring method: - <%= @tournament.scoring_method.titleize %> -

- -<% @tournament.settings.each do |setting| %> -

- <%= setting.name %> - <%= setting.value %> -

-<% end %> +

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

-
+
+

+ Status: + <% if @tournament.status == 0 %> + Waiting for players... + <% else %> + Started + <% end %> +

+ +

+ Name: + <%= @tournament.name %> +

+ +

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

+ +

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

+ +

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

+ +

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

+ +

+ Scoring method: + <%= @tournament.scoring_method.titleize %> +

+ + <% @tournament.settings.each do |setting| %> +

+ <%= setting.name %> + <%= setting.value %> +

+ <% end %> +
-
-<%# Show all players in the tournament %> -<% if @tournament.players.length > 0 %> -

Players Here:

- - <% else %> -

Hmmm.... nobody's here yet! You and your friends should join the tournament.

-<% end %> +
+ <% if @tournament.players.length > 0 %> +

Players Here:

+
    + <% @tournament.players.each do |p| %> +
  • <%= p.user_name %>
  • + <% end %> +
+ <% else %> +

Hmmm.... nobody's here yet! You and your friends should join the tournament.

+ <% end %> +
-<%# 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 Tournament") %> - <% end %> - -<% elsif @tournament.players.include?(current_user) %> - <%= form_tag(tournament_path(@tournament), method: "put") do %> - - <%= submit_tag("Leave Tournament") %> - <% end %> -<% end %> - -<%# If user is the host, let them start the tournment %> -<% if @tournament.hosts.include?(current_user) %> - - <%= form_tag(tournament_path(@tournament), method: "put") 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 %> | - <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' } %> - <% end %> + <%# 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 Tournament") %> + <% end %> + <% elsif @tournament.players.include?(current_user) %> + <%= form_tag(tournament_path(@tournament), method: "put") do %> + + <%= submit_tag("Leave Tournament") %> + <% end %> + <% end %> + + <%# If user is the host, let them start the tournment %> + <% if @tournament.hosts.include?(current_user) %> + <%= form_tag(tournament_path(@tournament), method: "put") 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 %> + <% end %> + <%= link_to 'Edit', edit_tournament_path(@tournament) %> | + <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' } %> + <% end %>
-<%end %> -
- +<%= link_to 'Back', tournaments_path %> diff --git a/lib/sampling/peer_review.html.erb b/lib/sampling/peer_review.html.erb index 8ff350e..e744936 100644 --- a/lib/sampling/peer_review.html.erb +++ b/lib/sampling/peer_review.html.erb @@ -1,12 +1,12 @@ <% if @feedbacks_missing.include? @user %> -- cgit v1.2.3