summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-28 11:06:04 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-28 11:06:04 -0400
commit1d509d6109c402545e08917e65fd09b471553900 (patch)
tree9a055bca130340d51b41ef75b6f678a9f60b2d90 /app
parent0f62d8708b28f0fc4563fb9861cea63c8dfa993c (diff)
tidy various forms and inline CSS
Diffstat (limited to 'app')
-rw-r--r--app/views/common/_show_tournament.html.erb12
-rw-r--r--app/views/common/_show_user.html.erb4
-rw-r--r--app/views/servers/_form.html.erb29
-rw-r--r--app/views/tournaments/_form.html.erb173
4 files changed, 98 insertions, 120 deletions
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb
index 454377e..826eeaa 100644
--- a/app/views/common/_show_tournament.html.erb
+++ b/app/views/common/_show_tournament.html.erb
@@ -6,18 +6,18 @@
<div class="col-md-8 col-sm-7 col-xs-6">
<%# "header" %>
<%= link_to(target) do %><h3><%= target.name %></h3><% end %>
- <div class="row" style="margin-left:2%;">
+ <div class="row">
<div class="col-md-4 host">
<%= image_tag('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.hosts.first.email) + '?s=45&d=identicon') %>
<%= target.hosts.first.name %>'s tournament
</div>
<div class="col-md-4 things">
- <p> Players per team: <%= target.min_players_per_team %></p>
- <p> Players signed up: <%= target.players.count %> </p>
+ <p>Players per team: <%= target.min_players_per_team %></p>
+ <p>Players signed up: <%= target.players.count %></p>
</div>
<div class="col-md-4 things">
- <p> <%# (target.randomized_teams)? "Teams are Random" : "Teams are Chosen" %></p>
- <p> Players signed up: <%= target.players.count %> </p>
+ <p><%# (target.randomized_teams)? "Teams are Random" : "Teams are Chosen" %></p>
+ <p>Players signed up: <%= target.players.count %></p>
</div>
</div>
</div>
@@ -31,7 +31,7 @@
<% end %>
</p>
<% elsif target.players.include?(current_user)%>
- <p style="margin-top:10px;"> You've signed up for this tournament! </p>
+ <p class="message">You've signed up for this tournament!</p>
<% end %>
<% if target.status == 1 && target.stages.first.scheduling_method == "elimination" && target.stages.first.matches.first.status == 0 %>
<%= form_tag(tournament_brackets_path(target), method: "post") do %>
diff --git a/app/views/common/_show_user.html.erb b/app/views/common/_show_user.html.erb
index dd136a0..e442474 100644
--- a/app/views/common/_show_user.html.erb
+++ b/app/views/common/_show_user.html.erb
@@ -6,7 +6,7 @@
<%# "header" %>
<%= link_to(target) do %><h3><%= target.user_name %></h3><% end %>
- <div class="row" style="margin-left:2%;">
+ <div class="row">
<div class="col-md-6 things">
<p> Preferred Name: </p>
<p> <%= target.name %></p>
@@ -21,4 +21,4 @@
</div>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb
index 8853a80..fd887f3 100644
--- a/app/views/servers/_form.html.erb
+++ b/app/views/servers/_form.html.erb
@@ -1,19 +1,16 @@
<%= form_for(@server) do |f| %>
- <%= render "common/error_messages", :target => @server %>
+ <%= render "common/error_messages", :target => @server %>
- <fieldset style="color: rgb(221, 145, 37)">
- <legend style="color: rgb(221, 145, 37); border-color: rgb(221, 145, 37)">Default permissions for new users</legend>
- <ul >
- <%= fields_for "server[default_user_abilities]", @server.default_user_abilities do |a| %>
- <% @server.default_user_abilities.keys.each do |ability| %>
- <li ><label><%= a.check_box(ability) %> <%= ability.to_s.humanize %></label></li>
- <% end %>
- <% end %>
- </ul>
- </fieldset>
- <p>
- <div class="actions">
- <%= f.submit %>
- </div>
- </p>
+ <%= fields_for "server[default_user_abilities]", @server.default_user_abilities do |a| %>
+ <fieldset>
+ <legend>Default permissions for new users</legend>
+ <ul>
+ <% @server.default_user_abilities.keys.each do |ability| %>
+ <li><label><%= a.check_box(ability) %> <%= ability.to_s.humanize %></label></li>
+ <% end %>
+ </ul>
+ </fieldset>
+ <% end %>
+
+ <%= f.submit %>
<% end %>
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index 38f01ee..0937fd2 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -1,9 +1,5 @@
<%= 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>
@@ -13,113 +9,98 @@
</p>
<% end %>
- <% if @tournament.game.nil? %>
</fieldset>
-<% else %>
+<% if @tournament.game %>
<%= form_for(@tournament, url: tournaments_path, method: "post") do |f| %>
- <%= f.hidden_field(:game_id) %>
- <p>
- <%= f.label :name %>
- <%= f.text_field :name %>
- </p>
- <div>
+ <fieldset>
+ <legend>Attributes</legend>
+
+ <%= f.hidden_field(:game_id) %>
<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>
+ <%= f.label :name %>
+ <%= f.text_field :name %>
</p>
- </div>
- <div id="teams-table">
- <p>
- <table><tbody>
+ <table>
+ <tbody>
+ <tr>
+ <td></td>
+ <th>Minimum</th>
+ <th>Maximum</th>
+ </tr>
+ <tr>
+ <th>Players per team: </th>
+ <td><%= f.text_field(:min_players_per_team, type: :number, min: 1) %></td>
+ <td><%= f.text_field(:max_players_per_team, type: :number, min: 1) %></td>
+ </tr>
<tr>
<th>Teams per match: </th>
- <td style="padding:5px"><%= f.text_field(:min_teams_per_match, type: :number, min: 1) %></td>
- <td style="padding:5px"><%= f.text_field(:max_teams_per_match, type: :number, min: 1) %></td>
+ <td><%= f.text_field(:min_teams_per_match, type: :number, min: 1) %></td>
+ <td><%= f.text_field(:max_teams_per_match, type: :number, min: 1) %></td>
</tr>
- </tbody></table>
- </P>
- </div>
+ </tbody>
+ </table>
- <p>
- <%= f.label :scoring_method %>
- <%= f.select(:scoring_method, @tournament.scoring_methods.map{|method| [method.humanize.titleize, method]}) %>
- </p>
-</fieldset>
+ <p>
+ <%= f.label :scoring_method %>
+ <%= f.select(:scoring_method, @tournament.scoring_methods.map{|method| [method.humanize.titleize, method]}) %>
+ </p>
+ </fieldset>
-<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 %>
- <br>
- <% case setting.vartype %>
- <% when 0 %>
- <%= setting_fields.text_field( setting.name ) %>
- <% when 1 %>
- <%= setting_fields.text_area( setting.name ) %>
- <% when 2 %>
- <ul>
- <% setting.type_opt.split(',').each do |option|%>
- <li><label><%= setting_fields.radio_button( setting.name, option ) %><%= option.humanize %></label></li>
- <% end %>
- </ul>
- <% when 3 %>
- <ul>
- <% setting.type_opt.split(',').each do |option|%>
- <li><label><%= check_box_tag("tournament[settings][#{setting.name}][]", option, setting.value.split(',').include?(option)) %><%= option.humanize %></label></li>
- <% end %>
- </ul>
- <% 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(',').collect {|opt| opt.humanize.titleize} ) %>
+ <fieldset>
+ <legend>Settings</legend>
+ <%= f.fields_for :settings do |setting_fields| %>
+ <% @tournament.tournament_settings.each do |setting| %>
+ <p>
+ <%= setting_fields.label setting.name %>
+ <br>
+ <% case setting.vartype %>
+ <% when 0 %>
+ <%= setting_fields.text_field( setting.name ) %>
+ <% when 1 %>
+ <%= setting_fields.text_area( setting.name ) %>
+ <% when 2 %>
+ <ul>
+ <% setting.type_opt.split(',').each do |option|%>
+ <li><label><%= setting_fields.radio_button( setting.name, option ) %><%= option.humanize %></label></li>
+ <% end %>
+ </ul>
+ <% when 3 %>
+ <ul>
+ <% setting.type_opt.split(',').each do |option|%>
+ <li><label><%= check_box_tag("tournament[settings][#{setting.name}][]", option, setting.value.split(',').include?(option)) %><%= option.humanize %></label></li>
+ <% end %>
+ </ul>
+ <% 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(',').collect {|opt| opt.humanize.titleize} ) %>
+ <% end %>
+ </p>
<% end %>
- </p>
<% end %>
- <% end %>
-</fieldset>
+ </fieldset>
- <%= f.fields_for :stages do |stages_fields| %>
+ <%= 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 %>
+ <legend>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 %>
+ <%= stages_fields.fields_for i.to_s do |stage_fields| %>
+ <fieldset>
+ <legend>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 %>
+ <% end %>
</fieldset>
- <% end %>
+ <% end %>
<%= f.submit %>