Added contest edit page styling

This commit is contained in:
Luke Barratt 2014-04-23 00:28:59 +01:00
parent 01d83fd95c
commit 66c0ce27e7
2 changed files with 112 additions and 118 deletions

View file

@ -55,6 +55,10 @@ body {
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
&.title {
margin-bottom: 1em;
}
&.fancy { &.fancy {
clear: both; clear: both;
text-align: center; text-align: center;

View file

@ -1,7 +1,7 @@
<h1>Editing Contest</h1> <h1 class="title">Editing Contest</h1>
<div id="contestTab"> <div id="contest" class="tabbed">
<ul id="contestTab-nav" class="tabs"> <ul id="contest-nav" class="tabs">
<li><a href="#general">General</a></li> <li><a href="#general">General</a></li>
<% if @contest.contest_type == Contest::TYPE_BRACKET %> <% if @contest.contest_type == Contest::TYPE_BRACKET %>
<li><a href="#brackets">Brackets</a></li> <li><a href="#brackets">Brackets</a></li>
@ -12,83 +12,80 @@
<li><a href="#matches">Matches</a></li> <li><a href="#matches">Matches</a></li>
</ul> </ul>
<div class="tabs box wide"> <div class="tabbed-contents">
<div class="tab" id="general"> <div class="tab" id="general">
<%= form_for @contest do |f| %> <%= form_for @contest, html: { class: 'square' } do |f| %>
<div id="error_explanation"> <%= render 'shared/errors', messages: @contest.errors.full_messages %>
<ul>
<% @contest.errors.full_messages.each do |msg| %> <div class="fields horizontal">
<li><%= msg %></li> <%= f.label :name %>
<% end %>
</ul>
</div>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %> <%= f.text_field :name %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :short_name %><br /> <%= f.label :short_name %>
<%= f.text_field :short_name %> <%= f.text_field :short_name %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :start %><br /> <%= f.label :start %>
<%= f.datetime_select :start %> <%= f.datetime_select :start, datetime_separator: '', time_separator: '' %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :end %><br /> <%= f.label :end %>
<%= f.datetime_select :end %> <%= f.datetime_select :end, datetime_separator: '', time_separator: '' %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :status %><br /> <%= f.label :status %>
<%= f.select :status, @contest.statuses.invert %> <%= f.select :status, @contest.statuses.invert %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :demos_id %><br /> <%= f.label :demos_id %>
<%= f.select :demos_id, Directory.all.collect{|d| [d, d.id]} %> <%= f.select :demos_id, Directory.all.collect{|d| [d, d.id]} %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :default_time %><br /> <%= f.label :default_time %>
<%= f.time_select :default_time %> <%= f.time_select :default_time, time_separator: '' %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :winner_id %><br /> <%= f.label :winner_id %>
<%= f.select :winner_id, @contest.contesters.collect{|t| [t.team, t.id]}, :include_blank => true %> <%= f.select :winner_id, @contest.contesters.collect { |t| [t.team, t.id] }, include_blank: true %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :rules_id %><br /> <%= f.label :rules_id %>
<%= f.select :rules_id, Category.find(Category::RULES).articles.collect{|a| [a, a.id]}, :include_blank => true %> <%= f.select :rules_id, Category.find(Category::RULES).articles.collect { |a| [a, a.id] }, include_blank: true %>
</p> </div>
<% if @contest.contest_type == Contest::TYPE_LADDER %> <% if @contest.contest_type == Contest::TYPE_LADDER %>
<p> <div class="fields horizontal">
<%= f.label :weight %><br /> <%= f.label :weight %>
<%= f.text_field :weight %> <%= f.text_field :weight %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :modulus_base %><br /> <%= f.label :modulus_base %>
<%= f.text_field :modulus_base %> <%= f.text_field :modulus_base %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :modulus_even %><br /> <%= f.label :modulus_even %>
<%= f.text_field :modulus_even %> <%= f.text_field :modulus_even %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :modulus_3to1 %><br /> <%= f.label :modulus_3to1 %>
<%= f.text_field :modulus_3to1 %> <%= f.text_field :modulus_3to1 %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :modulus_4to0 %><br /> <%= f.label :modulus_4to0 %>
<%= f.text_field :modulus_4to0 %> <%= f.text_field :modulus_4to0 %>
</p> </div>
<% end %> <% end %>
<p>
<%= f.submit 'Save' %> <div class="controls">
</p> <%= f.submit 'Save Contest' %>
</div>
<% end %> <% end %>
</div> </div>
<% if @contest.contest_type == Contest::TYPE_BRACKET %> <% if @contest.contest_type == Contest::TYPE_BRACKET %>
<div class="tab" id="brackets"> <div class="tab" id="brackets">
<table class="data"> <table class="striped">
<tr> <tr>
<th>Bracket</th> <th>Bracket</th>
<th>Slots</th> <th>Slots</th>
@ -96,37 +93,35 @@
</tr> </tr>
<% @contest.brackets.each do |bracket| %> <% @contest.brackets.each do |bracket| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= namelink bracket %></td> <td><%= namelink bracket %></td>
<td><%= bracket.slots %></td> <td><%= bracket.slots %></td>
<td> <td>
<%= link_to 'Edit', edit_bracket_path(bracket) %> <%= link_to icon('pencil'), edit_bracket_path(bracket) %>
<%= link_to 'Destroy', bracket, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), bracket, confirm: 'Are you sure?', method: :delete %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= form_for @contest.brackets.build do |f| %> <%= form_for @contest.brackets.build, html: { class: 'square' } do |f| %>
<div id="error_explanation"> <%= render 'shared/errors', messages: @contest.brackets.last.errors.full_messages %>
<ul>
<% @contest.brackets.last.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<%= f.hidden_field :contest_id %> <%= f.hidden_field :contest_id %>
<p>
<div class="fields horizontal">
<%= f.label :slots %> <%= f.label :slots %>
<%= f.text_field :slots %> <%= f.text_field :slots %>
</div>
<div class="controls">
<%= f.submit 'Add Bracket' %> <%= f.submit 'Add Bracket' %>
</p> </div>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<div class="tab" id="maps"> <div class="tab" id="maps">
<table class="data"> <table class="striped">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Download</th> <th>Download</th>
@ -134,34 +129,31 @@
</tr> </tr>
<% @contest.maps.basic.each do |map| %> <% @contest.maps.basic.each do |map| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= namelink map %></td> <td><%= namelink map %></td>
<td><%= h map.download %></td> <td><%= h map.download %></td>
<td> <td>
<%= link_to 'Edit', edit_map_path(map) %> <%= link_to icon('pencil'), edit_map_path(map) %>
<%= link_to 'Remove', :action => "del_map", :id => @contest.id, :id2 => map.id %> <%= link_to icon('times'), action: "del_map", id: @contest.id, id2: map.id %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= form_for @contest do |f| %> <%= form_for @contest do |f| %>
<div id="error_explanation"> <%= render 'shared/errors', messages: @contest.errors.full_messages %>
<ul>
<% @contest.errors.full_messages.each do |msg| %> <div class="fields">
<li><%= msg %></li>
<% end %>
</ul>
</div>
<p>
<%= select_tag :map, options_from_collection_for_select(Map.basic, :id, :name) %> <%= select_tag :map, options_from_collection_for_select(Map.basic, :id, :name) %>
</div>
<div class="controls">
<%= f.submit 'Add map' %> <%= f.submit 'Add map' %>
</p> </div>
<% end %> <% end %>
</div> </div>
<div class="tab" id="teams"> <div class="tab" id="teams">
<table class="data"> <table class="striped">
<tr> <tr>
<th>Team</th> <th>Team</th>
<th>Score</th> <th>Score</th>
@ -170,19 +162,19 @@
</tr> </tr>
<% @contest.contesters.each do |contester| %> <% @contest.contesters.each do |contester| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= link_to (h contester.team), contester %></td> <td><%= link_to (h contester.team), contester %></td>
<td><%= h contester.score %></td> <td><%= h contester.score %></td>
<td><%= contester.statuses[contester.active] %></td> <td><%= contester.statuses[contester.active] %></td>
<td> <td>
<% if contester.active %> <% if contester.active %>
<%= link_to 'Edit', edit_contester_path(contester) %> <%= link_to icon('pencil'), edit_contester_path(contester) %>
<%= link_to 'Delete', contester, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), contester, confirm: 'Are you sure?', method: :delete %>
<% else %> <% else %>
<%= form_for contester do |c| %> <%= form_for contester do |c| %>
<%= c.hidden_field :active, {:value => 1} %> <%= c.hidden_field :active, { value: 1 } %>
<%= link_to 'Edit', edit_contester_path(contester) %> <%= link_to icon('pencil'), edit_contester_path(contester) %>
<%= link_to_function 'Recover', "$('edit_contester_#{contester.id}').submit()" %> <%= link_to_function icon('rotate-left'), "$('edit_contester_#{contester.id}').submit()" %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>
@ -191,23 +183,21 @@
</table> </table>
<%= form_for @contest.contesters.build do |f| %> <%= form_for @contest.contesters.build do |f| %>
<div id="error_explanation"> <%= render 'shared/errors', messages: @contest.contesters.last.errors.full_messages %>
<ul>
<% @contest.contesters.last.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<%= f.hidden_field :contest_id %> <%= f.hidden_field :contest_id %>
<p>
<div class="fields">
<%= f.select :team_id, Team.active.ordered.collect{|t| [t, t.id]} %> <%= f.select :team_id, Team.active.ordered.collect{|t| [t, t.id]} %>
<%= f.submit 'Add team' %> </div>
</p> <div class="controls">
<%= f.submit 'Add Team' %>
</div>
<% end %> <% end %>
</div> </div>
<div class="tab" id="weeks"> <div class="tab" id="weeks">
<table class="data"> <table class="striped">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Start date</th> <th>Start date</th>
@ -223,18 +213,18 @@
<td><%= h week.map1 %></td> <td><%= h week.map1 %></td>
<td><%= h week.map2 %></td> <td><%= h week.map2 %></td>
<td> <td>
<%= link_to 'Edit', edit_week_path(week) %> <%= link_to icon('pencil'), edit_week_path(week) %>
<%= link_to 'Destroy', week, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), week, confirm: 'Are you sure?', method: :delete %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= link_to "New Week", :controller => :weeks, :action => :new, :id => @contest %> <%= link_to "New Week", { controller: :weeks, action: :new, id: @contest }, { class: 'button' } %>
</div> </div>
<div class="tab" id="matches"> <div class="tab" id="matches">
<table class="data"> <table class="striped">
<tr> <tr>
<th>Teams</th> <th>Teams</th>
<th>Date</th> <th>Date</th>
@ -258,21 +248,21 @@
<% end %> <% end %>
</td> </td>
<td> <td>
<%= link_to 'Referee', :controller => :matches, :action => :ref, :id => match %> <%= link_to icon('flag-checkered'), controller: :matches, action: :ref, id: match %>
<%= link_to 'Edit', edit_match_path(match) %> <%= link_to icon('pencil'), edit_match_path(match) %>
<%= link_to 'Delete', match, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), match, confirm: 'Are you sure?', method: :delete %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= link_to "New Match", :controller => :matches, :action => :new, :id => @contest %> <%= link_to "New Match", { controller: :matches, action: :new, id: @contest }, { class: 'button' } %>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var tabber1 = new Yetii({id: 'contestTab'}); new Yetii({
id: 'contest'
});
</script> </script>
<%= link_to 'Back', @contest %>