diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-28 00:04:47 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-28 00:04:47 -0400 |
commit | 6b66877bda4c0e4a33bb3109304636d5ada85904 (patch) | |
tree | 7065307802fec8452afc89c8a7b445fd2ceca772 /app/views | |
parent | 33fcf6de9feaaa6f90dfe5082e08d280c930dae1 (diff) | |
parent | 7a4832621f1a0bb2e4b86ee9f879a73df0188a3e (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/common/_show_tournament.html.erb | 6 | ||||
-rw-r--r-- | app/views/layouts/application.html.erb | 5 | ||||
-rw-r--r-- | app/views/pms/index.html.erb | 16 | ||||
-rw-r--r-- | app/views/tournaments/_form.html.erb | 112 | ||||
-rw-r--r-- | app/views/tournaments/standings.html.erb | 4 |
5 files changed, 81 insertions, 62 deletions
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb index 151e5d2..12a7fea 100644 --- a/app/views/common/_show_tournament.html.erb +++ b/app/views/common/_show_tournament.html.erb @@ -33,8 +33,10 @@ <% else %> <p style="margin-top:10px;"> You've signed up for this tournament! </p> <% end %> - <%= form_tag(tournament_brackets_path(target), method: "post") do %> - <%= submit_tag("Make Bracket") %> + <% if target.status == 1 %> + <%= form_tag(tournament_brackets_path(target), method: "post") do %> + <%= submit_tag("Make Bracket") %> + <% end %> <% end %> <% end %> </div> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9eea734..f3535e9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -35,9 +35,8 @@ <%= link_to "Create Alert", new_alert_path, :class => "create-alert" %> <% end %> <%= link_to "Sign out", session_path("current"), method: "delete", :class => "signout" %> - <%= link_to "", alerts_path, :class => "alerts"%> - - + <%# if there is an unread alert then I wanna be able to show the notification icon by saying :style => display:inline. This will be Done by Guntas once he figures out how to get unread alerts. Psuedo if alerts.unread > 0 then display else don't.%> + <%= link_to "", alerts_path, :class => "alerts", :id => "alerts-ajax"%> <% else %> <%= link_to "Log in", new_session_path, :class => "signin" %> <%= link_to "Sign up", new_user_path, :class => "signup" %> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index a1feb42..056b371 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -11,7 +11,7 @@ <col width="250"> <col width="300"> <tbody> - <% if conversations.reject { |c| c.is_unread?(current_user) && (c.receipts_for current_user).last.message.sender != current_user }.empty? %> + <%# if conversations.reject { |c| c.is_unread?(current_user) && (c.receipts_for current_user).last.message.sender != current_user }.empty? %> <tr> <tr> <td><b>With</b></td> @@ -38,9 +38,9 @@ <% end %> <% end %> </tr> - <% else %> - <h4> No unread conversations </h4> - <% end %> + <%# else %> + + <%# end %> </tbody> </table> @@ -53,7 +53,7 @@ <col width="250"> <col width="300"> <tbody> - <% if conversations.reject { |c| c.is_read?(current_user) || (c.receipts_for current_user).last.message.sender == current_user }.empty? %> + <%# if conversations.reject { |c| c.is_read?(current_user) || (c.receipts_for current_user).last.message.sender == current_user }.empty? %> <tr> <tr> <td><b>With</b></td> @@ -80,8 +80,8 @@ <% end %> <% end %> </tr> - <% else %> - <h4> No unread conversations </h4> - <% end %> + <% #else %> + + <% #end %> </tbody> </table>
\ No newline at end of file diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 90e0257..2a871ea 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -1,36 +1,42 @@ <%= render "common/error_messages", :target => @tournament %> -<fieldset><legend style="color:rgb(221, 145, 37)">Attributes</legend> -<%= form_for(@tournament, url: new_tournament_path, method: "get") do |f| %> - <%= render "common/error_messages", :target => @tournament %> - <p> - <%= f.label :game_id, "Select a game type" %> - <%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %> - <%= f.submit("Select") %> - </p> -<% end %> +<fieldset> + + <legend style="color:rgb(221, 145, 37)">Attributes + </legend> + + <%= form_for(@tournament, url: new_tournament_path, method: "get") do |f| %> + <%= render "common/error_messages", :target => @tournament %> + <p> + <%= f.label :game_id, "Select a game type" %> + <%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %> + <%= f.submit("Select") %> + </p> + <% end %> -<% if @tournament.game.nil? %> - </fieldset> + <% if @tournament.game.nil? %> +</fieldset> <% else %> <%= form_for(@tournament, url: tournaments_path, method: "post") do |f| %> - <p> <%= f.label :name %> <%= f.text_field :name %> </p> <div> <p> - <table><tbody> - <tr> - <td></td> - <th style="padding:5px">Minimum</th> - <th style="padding:5px">Maximum</th></tr> - <tr> - <th>Players per team: </th> - <td style="padding:5px"><%= f.text_field(:min_players_per_team, type: :number, min: 1) %></td> - <td style="padding:5px"><%= f.text_field(:max_players_per_team, type: :number, min: 1) %></td> - </tr> - </tbody></table> + <table> + <tbody> + <tr> + <td></td> + <th style="padding:5px">Minimum</th> + <th style="padding:5px">Maximum</th> + </tr> + <tr> + <th>Players per team: </th> + <td style="padding:5px"><%= f.text_field(:min_players_per_team, type: :number, min: 1) %></td> + <td style="padding:5px"><%= f.text_field(:max_players_per_team, type: :number, min: 1) %></td> + </tr> + </tbody> + </table> </p> </div> @@ -48,7 +54,7 @@ <p> <%= f.label :scoring_method %> - <%= f.select(:scoring_method, @tournament.scoring_methods.map{|method| [method.humanize, method]}) %> + <%= f.select(:scoring_method, @tournament.scoring_methods.map{|method| [method.humanize.titleize, method]}) %> </p> <p> @@ -56,9 +62,11 @@ <%= f.select(:sampling_method, @tournament.sampling_methods.map{|method| [method.humanize, method]}) %> </p> - </fieldset> +</fieldset> - <fieldset><legend style="color:rgb(221, 145, 37)">Settings</legend> +<fieldset> + <legend style="color:rgb(221, 145, 37)">Settings + </legend> <%= f.fields_for :settings do |setting_fields| %> <% @tournament.tournament_settings.each do |setting| %><p> <%= setting_fields.label setting.name %> @@ -84,31 +92,41 @@ <%= setting_fields.radio_button( setting.name, "true" ) %> True <%= setting_fields.radio_button( setting.name, "false" ) %> False <% when 5 %> - <%= setting_fields.select( setting.name, setting.type_opt.split(',') ) %> + <%= setting_fields.select( setting.name, setting.type_opt.split(',').collect {|opt| opt.humanize.titleize} ) %> <% end %> - </p><% end %> - <% end %> - </fieldset> - - <%= f.fields_for :stages do |stages_fields| %><fieldset><legend style="color:rgb(221, 145, 37)">Stages</legend> - <label for="num_stages">Number of tournament stages</label> - <input type="number" name="num_stages" min="1" value="<%= params[:num_stages].to_i %>"> - <%# stage_fields.submit("Set Stages") %> - <% for i in 1..(params[:num_stages].to_i) do %> - <p> - <%= stages_fields.fields_for i.to_s do |stage_fields| %><fieldset><legend style="color:rgb(221, 145, 37)">Stage <%= i %></legend> - <%= 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]}) %> - </fieldset><% end %> - </p> + </p> <% end %> - </fieldset> <% end %> +</fieldset> + + <%= f.fields_for :stages do |stages_fields| %> + <fieldset> + + <legend style="color:rgb(221, 145, 37)">Stages + + </legend> + <label for="num_stages">Number of tournament stages + </label> + <input type="number" name="num_stages" min="1" value="<%= params[:num_stages].to_i %>"> + <%# stage_fields.submit("Set Stages") %> + <% for i in 1..(params[:num_stages].to_i) do %> + <p> + <%= stages_fields.fields_for i.to_s do |stage_fields| %> + <fieldset> + <legend style="color:rgb(221, 145, 37)">Stage <%= i %> + </legend> + <%= 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]}) %> + </fieldset> + <% end %> + </p> + <% end %> + </fieldset> + <% end %> <%= f.submit %> - <%# render 'stages' %> - <% end %> <% end %> +<% end %> diff --git a/app/views/tournaments/standings.html.erb b/app/views/tournaments/standings.html.erb index b8739de..a04e132 100644 --- a/app/views/tournaments/standings.html.erb +++ b/app/views/tournaments/standings.html.erb @@ -1,7 +1,7 @@ -<% playerscores = @tournament.players.collect {|player| player => @tournament.statistics.getStatistic(player.matches.last, player, :score) } %> +<% playerscores = @tournament.players.collect {|player| player => @tournament.statistics.where(match: player.matches.last, user: player, name: :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 } } } %> +{ |player| player.user_name => @tournament.statistics.where(match: player.matches.last, user: player, name: :score } } } %> <table> <tr> |