From 6cbf08bb7659dc3265b45d05a66170f1c69ce696 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Sun, 27 Apr 2014 23:26:00 -0400 Subject: Alerts now have AJAX. Seeds were changed for tournaments to have sampling methods. --- app/views/layouts/application.html.erb | 5 +- app/views/tournaments/_form.html.erb | 150 ++++++++++++++++++--------------- 2 files changed, 86 insertions(+), 69 deletions(-) (limited to 'app/views') 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/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 90e0257..d89e0bc 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 %> -
Attributes -<%= 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]}) %> - <%= f.submit("Select") %> -

-<% end %> +
+ + Attributes + + + <%= 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]}) %> + <%= f.submit("Select") %> +

+ <% end %> -<% if @tournament.game.nil? %> -
+ <% if @tournament.game.nil? %> +
<% else %> <%= form_for(@tournament, url: tournaments_path, method: "post") do |f| %> -

<%= 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) %>
+ + + + + + + + + + + + + +
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) %>

@@ -56,59 +62,71 @@ <%= f.select(:sampling_method, @tournament.sampling_methods.map{|method| [method.humanize, method]}) %>

- + -
Settings +
+ Settings + <%= f.fields_for :settings do |setting_fields| %> <% @tournament.tournament_settings.each do |setting| %>

<%= setting_fields.label setting.name %>
<% case setting.vartype %> - <% when 0 %> - <%= setting_fields.text_field( setting.name ) %> - <% when 1 %> - <%= setting_fields.text_area( setting.name ) %> - <% when 2 %> -

    - <% setting.type_opt.split(',').each do |option|%> -
  • - <% end %> -
- <% when 3 %> -
    - <% setting.type_opt.split(',').each do |option|%> -
  • - <% end %> -
- <% when 4 %> - <%= 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(',') ) %> + <% when 0 %> + <%= setting_fields.text_field( setting.name ) %> + <% when 1 %> + <%= setting_fields.text_area( setting.name ) %> + <% when 2 %> +
    + <% setting.type_opt.split(',').each do |option|%> +
  • + <% end %> +
+ <% when 3 %> +
    + <% setting.type_opt.split(',').each do |option|%> +
  • + <% end %> +
+ <% when 4 %> + <%= 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(',') ) %> <% end %> -

<% end %> - <% end %> -
- - <%= f.fields_for :stages do |stages_fields| %>
Stages - - - <%# stage_fields.submit("Set Stages") %> - <% 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 %> -

+

<% end %> -
<% end %> +
+ + <%= f.fields_for :stages do |stages_fields| %> +
+ + Stages + + + + + <%# stage_fields.submit("Set Stages") %> + <% 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 %> +

+ <% end %> +
+ <% end %> <%= f.submit %> - <%# render 'stages' %> - <% end %> <% end %> +<% end %> -- cgit v1.2.3