From df1cda1faab97f4c424efdcf8b6822f98b73adb8 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Sun, 27 Apr 2014 20:47:31 -0400 Subject: Made some CSS changes all over the website. Added an alert icon.still need ajax to work with it --- app/views/tournaments/_form.html.erb | 64 +++++++++++++++++++------------- app/views/tournaments/standings.html.erb | 20 +++++++++- 2 files changed, 56 insertions(+), 28 deletions(-) (limited to 'app/views/tournaments') diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index cb4c175..2212515 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -3,7 +3,7 @@ method: (@tournament.game.nil? ? "get" : "post")) do |f| %> <%= render "common/error_messages", :target => @tournament %> -
Attributes +
Attributes

<%= f.label :game_id, "Select a game type" %> <%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %> @@ -18,23 +18,33 @@ <%= f.label :name %> <%= f.text_field :name %>

- - - - - - - - - - - - - - - - -
MinimumMaximum
Players per team<%= f.text_field(:min_players_per_team, type: :number, min: 1) %><%= f.text_field(:max_players_per_team, type: :number, min: 1) %>
Teams per match<%= f.text_field(:min_teams_per_match, type: :number, min: 1) %><%= f.text_field(:max_teams_per_match, type: :number, min: 1) %>
+
+

+ + + + + + + + + + +
MinimumMaximum
Players per team: <%= f.text_field(:min_players_per_team, type: :number, min: 1) %><%= f.text_field(:max_players_per_team, type: :number, min: 1) %>
+

+
+ +
+

+ + + + + + +
Teams per match: <%= f.text_field(:min_teams_per_match, type: :number, min: 1) %><%= f.text_field(:max_teams_per_match, type: :number, min: 1) %>
+

+

<%= f.label :scoring_method %> @@ -48,7 +58,7 @@

-
Settings +
Settings <%= f.fields_for :settings do |setting_fields| %> <% (@tournament.settings.empty? ? @tournament.game.settings : @tournament.settings).each do |setting| %>

<% name = setting.name.parameterize.underscore %> @@ -81,17 +91,19 @@ <% end %>

- <%= f.fields_for :stages do |stages_fields| %>
Stages + <%= f.fields_for :stages do |stages_fields| %>
Stages <%# submit_tag("Set Stages", :class => "btn") %> <% for i in 1..(params[:num_stages].to_i) do %> - <%= stages_fields.fields_for i.to_s do |stage_fields| %>
Stage <%= i %> - <%= stage_fields.label :scheduling_method %> - <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize, method]}) %> - <%= stage_fields.label :seeding_method %> - <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize, method]}) %> -
<% end %> +

+ <%= stages_fields.fields_for i.to_s do |stage_fields| %>

Stage <%= i %> + <%= stage_fields.label :scheduling_method %> + <%= stage_fields.select(:scheduling_method, @tournament.scheduling_methods.map{|method| [method.humanize, method]}) %> + <%= stage_fields.label :seeding_method %> + <%= stage_fields.select(:seeding_method, @tournament.seeding_methods.map{|method| [method.humanize, method]}) %> +
<% end %> +

<% end %>
<% end %> diff --git a/app/views/tournaments/standings.html.erb b/app/views/tournaments/standings.html.erb index 28d3c22..b8739de 100644 --- a/app/views/tournaments/standings.html.erb +++ b/app/views/tournaments/standings.html.erb @@ -1,4 +1,7 @@ -<% playerscores = @tournament.players.collect {|player| player => tournament.statistics.getStatistic(player.matches.last, player, :score) } %> +<% playerscores = @tournament.players.collect {|player| player => @tournament.statistics.getStatistic(player.matches.last, player, :score) } %> +<% teams = tournament_stage.matches.collect +{ |match| match.teams.collect { |team| team.id => team.players.collect +{ |player| player.user_name => @tournament.statistics.getStatistic(player.matches.last, player, :score } } } %> @@ -9,4 +12,17 @@ <% place += 1%> <% end %> -
\ No newline at end of file + + +<% teams.each do |team| %> + + + + <% place = 0 %> + <% team.values.sort {|player1, player2| playerscores[player1] <=> playerscores[player2] }.each |player| %> + + <% place += 1%> + <% end %> + +
Standings:<%= place.to_s + ":" %> <%= player.user_name %>
+<% end %> \ No newline at end of file -- cgit v1.2.3-2-g168b