summaryrefslogtreecommitdiff
path: root/app/views/tournaments
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-06 19:56:33 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-06 19:56:33 -0500
commita1700f50ee800cfbfb93bd7dfff7b5d79ae2cb2f (patch)
treec9db0b8bdd4818f5ce2ff982657e2aedfda98f8f /app/views/tournaments
parent706392b7c4520382ddd8f827b31205c6b71f5320 (diff)
parent63830b0f939db5f6911218950525428420c4d467 (diff)
Merge branch 'master2'
Conflicts: app/controllers/tournaments_controller.rb app/models/tournament.rb app/views/tournaments/_selected.html.erb app/views/tournaments/new.html.erb config/routes.rb
Diffstat (limited to 'app/views/tournaments')
-rw-r--r--app/views/tournaments/_selected.html.erb13
-rw-r--r--app/views/tournaments/index.html.erb9
-rw-r--r--app/views/tournaments/new.html.erb8
3 files changed, 20 insertions, 10 deletions
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
index 551dc40..9b1b7f8 100644
--- a/app/views/tournaments/_selected.html.erb
+++ b/app/views/tournaments/_selected.html.erb
@@ -2,14 +2,21 @@
<%= render "common/error_messages", :target => @tournament %>
<%= f.hidden_field(:game_id) %>
+ <% @chosen = Game.find_by(params[:game]) %>
<% @tournament.attributes.each do |name, value| %>
- <% if (name == "id") or (name =~ /.*_at$/) %>
+ <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") %>
<% next %>
<% end %>
<p>
- <%= f.label name %><br>
- <%= f.text_field name %>
+ <%= f.label name %><br>
+ <% if !@chosen.attributes[name].nil? %>
+ <%= f.text_field(name, :value => @chosen.attributes[name] ) %>
+ <% else %>
+ <%= f.text_field name %>
+ <% end %>
+
</p>
+
<% end %>
<%= f.submit %>
<% end %>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 3d54b8c..80d68a3 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -1,6 +1,7 @@
-<h1>Listing tournaments</h1>
+<h1>Listing Tournaments</h1>
-<table>
+<% if @tournaments.length > 0 %>
+<table class="table table-hover">
<thead>
<tr>
<th>Game</th>
@@ -35,7 +36,9 @@
<% end %>
</tbody>
</table>
-
+<% else %>
+ <p class="no-entries"> No tournaments going on right now... Why not start your own? </p>
+<% end %>
<br>
<%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning btn-lg" %>
diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb
index e007e31..8c74068 100644
--- a/app/views/tournaments/new.html.erb
+++ b/app/views/tournaments/new.html.erb
@@ -2,13 +2,13 @@
<%= 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-warning btn-lg") %>
+ 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 %>
<div id='ajax-form'>
- <% unless @tournament.game.nil? %>
+ <% if not @tournament.game.nil? %>
<%= render 'selected' %>
<% end %>
</div>