From 1ec0bbad344790e7181a586cd24914c677d20d32 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Thu, 6 Mar 2014 18:36:14 -0500 Subject: Here's Luke's stuff because he doesn't have wifi. --- app/views/tournaments/_selected.html.erb | 34 +++++++++----------------------- app/views/tournaments/new.html.erb | 14 ++++++------- 2 files changed, 16 insertions(+), 32 deletions(-) (limited to 'app/views') diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb index 5058c56..cfa91fa 100644 --- a/app/views/tournaments/_selected.html.erb +++ b/app/views/tournaments/_selected.html.erb @@ -1,31 +1,15 @@ <%= form_for(@tournament) do |f| %> - <% if @tournament.errors.any? %> -
-

<%= pluralize(@tournament.errors.count, "error") %> prohibited this tournament from being saved:

+ <%= render "common/error_messages", :target => @tournament %> + <%= f.hidden_field(:game_id) %> - -
- <% end %> - - <%# this is the dynamic script to output fields to the form %> - <% @chosen = Game.find(@game) %> - <% @chosen.attributes.each do |name, value| %> - <% if name == "id" %> + <% @tournament.attributes.each do |name, value| %> + <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") %> <% next %> <% end %> - <% if name == "created_at" %> - <% break %> - <% end %> -

- -
- value=<%= value %>> -

+

+ <%= f.label name %>
+ <%= f.text_field name %> +

<% end %> - <%= f.submit %> -<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index 3d6d142..1e80147 100644 --- a/app/views/tournaments/new.html.erb +++ b/app/views/tournaments/new.html.erb @@ -2,18 +2,18 @@

New Tournament

-<%= select_tag 'tournament_id', options_for_select(["Select a Game Type"] + Game.all.collect {|game| game.name}), :onchange => 'populate()' %> <%= link_to 'Select', 'new?game=1', :class => "btn btn-success btn-xs" %> +<%= form_tag(new_tournament_path, method: "get") do %> + <%= select_tag('game', + options_from_collection_for_select(@games, 'id', 'name', @tournament.game.nil? || @tournament.game.id), + :prompt => "Select a Game Type") %> + <%= submit_tag("Select", :class => "btn btn-success btn-xs") %> +<% end %> - -
- <% if not @game.nil? %> + <% if not @tournament.game.nil? %> <%= render 'selected' %> <% end %>
-

- -<%= link_to 'Select', 'selected', :class => "btn btn-success btn-xs" %> <%= link_to 'Back', tournaments_path %> -- cgit v1.2.3-54-g00ecf