Improves contests, gather archive and brackets styling

This commit is contained in:
Luke Barratt 2014-04-26 03:42:16 +01:00
parent 0b145b84d6
commit 0ba4b034d1
10 changed files with 327 additions and 185 deletions

View file

@ -188,3 +188,19 @@
margin-left: - em(20); margin-left: - em(20);
width: $max-width + $container-padding*2; width: $max-width + $container-padding*2;
} }
/*
Gather Archive
*/
table.gathers {
.date {
width: 30%;
}
.team1,
.team2 {
width: 35%;
}
}

View file

@ -129,6 +129,10 @@ table.brackets {
table { table {
margin: 0; margin: 0;
} }
> a {
padding-left: em(10);
}
} }
.bracket { .bracket {
@ -191,3 +195,141 @@ table.brackets {
} }
} }
} }
/*
Contest Form Page
*/
#contest.contest-manage {
table.maps {
.name {
width: 50%;
}
.download {
width: 40%;
}
.actions {
width: 10%;
text-align: right;
}
}
table.brackets-list {
width: 100%;
.bracket,
.slots {
width: 45%;
}
.actions {
width: 10%;
text-align: right;
}
}
table.weeks {
.name {
width: 30%;
}
.date,
.map1,
.map2 {
width: 20%;
}
.actions {
width: 10%;
text-align: right;
}
}
#matches {
margin: 0;
}
table.matches {
.team {
width: 50%;
}
.date {
text-align: left;
width: 20%;
}
.score {
width: 10%;
}
.actions {
width: 15%;
text-align: right;
}
}
}
/*
Contest List
*/
#contests {
@include span-columns(12);
div.current {
@include span-columns(12);
margin-bottom: em(20);
table {
.name {
width: 40%;
}
.date {
width: 20%;
}
.status {
width: 30%;
}
.actions {
width: 10%;
text-align: right;
}
}
}
div.previous {
@include span-columns(12);
margin-bottom: em(20);
table {
.name {
width: 40%;
}
.date {
width: 20%;
}
.winner {
width: 30%;
}
.actions {
width: 10%;
text-align: right;
}
}
}
}

View file

@ -3,6 +3,7 @@ class BracketsController < ApplicationController
def edit def edit
raise AccessError unless @bracket.can_update? cuser raise AccessError unless @bracket.can_update? cuser
render layout: 'full'
end end
def create def create

View file

@ -1,28 +1,18 @@
<h1> <h1 class="title">Editing Bracket</h1>
Editing bracket
</h1>
<div class="wide box"> <div class="wide box">
<%= form_for(@bracket) do |f| %> <%= form_for(@bracket) do |f| %>
<div id="error_explanation"> <%= render 'shared/errors', messages: @bracket.errors.full_messages %>
<ul>
<% @bracket.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<p> <div class="fields">
<%= f.label :slots %><br /> <%= f.label :slots %>
<%= f.text_field :slots %> <%= f.text_field :slots %>
</p>
<%= render :partial => "bracket", :locals => {:bracket => @bracket} %>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
</div> </div>
<%= link_to 'Back', edit_contest_path(@bracket.contest) %> <%= render partial: "bracket", locals: { bracket: @bracket } %>
<div class="controls">
<%= f.submit 'Update' %>
</div>
<% end %>
</div>

View file

@ -23,8 +23,8 @@
</table> </table>
<% end %> <% end %>
<%= render :partial => "brackets/bracket", :collection => contest.brackets %> <%= render partial: "brackets/bracket", collection: contest.brackets %>
<% if cuser and cuser.admin? and params[:action] != "historical" %> <% if cuser and cuser.admin? and params[:action] != "historical" %>
<%= link_to 'Edit', edit_contest_path(contest) %> <%= link_to 'Edit Brackets', edit_contest_path(contest), class: 'button' %>
<% end %> <% end %>

View file

@ -1,6 +1,6 @@
<h1 class="title">Editing Contest</h1> <h1 class="title">Editing Contest</h1>
<div id="contest" class="tabbed"> <div id="contest" class="contest-manage tabbed">
<ul id="contest-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 %>
@ -85,18 +85,18 @@
<% 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="striped"> <table class="brackets-list striped">
<tr> <tr>
<th>Bracket</th> <th class="bracket">Bracket</th>
<th>Slots</th> <th class="slots">Slots</th>
<th>Options</th> <th class="actions"></th>
</tr> </tr>
<% @contest.brackets.each do |bracket| %> <% @contest.brackets.each do |bracket| %>
<tr> <tr>
<td><%= namelink bracket %></td> <td><%= namelink bracket %></td>
<td><%= bracket.slots %></td> <td><%= bracket.slots %></td>
<td> <td class="actions">
<%= link_to icon('pencil'), edit_bracket_path(bracket) %> <%= link_to icon('pencil'), edit_bracket_path(bracket) %>
<%= link_to icon('times'), bracket, confirm: 'Are you sure?', method: :delete %> <%= link_to icon('times'), bracket, confirm: 'Are you sure?', method: :delete %>
</td> </td>
@ -121,18 +121,18 @@
<% end %> <% end %>
<div class="tab" id="maps"> <div class="tab" id="maps">
<table class="striped"> <table class="maps striped">
<tr> <tr>
<th>Name</th> <th class="name">Name</th>
<th>Download</th> <th class="download">Download</th>
<th>Options</th> <th class="actions"></th>
</tr> </tr>
<% @contest.maps.basic.each do |map| %> <% @contest.maps.basic.each do |map| %>
<tr> <tr>
<td><%= namelink map %></td> <td><%= namelink map %></td>
<td><%= h map.download %></td> <td><%= h map.download %></td>
<td> <td class="actions">
<%= link_to icon('pencil'), edit_map_path(map) %> <%= link_to icon('pencil'), edit_map_path(map) %>
<%= link_to icon('times'), action: "del_map", id: @contest.id, id2: map.id %> <%= link_to icon('times'), action: "del_map", id: @contest.id, id2: map.id %>
</td> </td>
@ -153,12 +153,12 @@
</div> </div>
<div class="tab" id="teams"> <div class="tab" id="teams">
<table class="striped"> <table class="teams striped">
<tr> <tr>
<th>Team</th> <th class="team">Team</th>
<th>Score</th> <th class="score">Score</th>
<th>Status</th> <th class="status">Status</th>
<th>Actions</th> <th class="actions"></th>
</tr> </tr>
<% @contest.contesters.each do |contester| %> <% @contest.contesters.each do |contester| %>
@ -166,7 +166,7 @@
<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 class="actions">
<% if contester.active %> <% if contester.active %>
<%= link_to icon('pencil'), edit_contester_path(contester) %> <%= link_to icon('pencil'), edit_contester_path(contester) %>
<%= link_to icon('times'), contester, confirm: 'Are you sure?', method: :delete %> <%= link_to icon('times'), contester, confirm: 'Are you sure?', method: :delete %>
@ -197,13 +197,13 @@
</div> </div>
<div class="tab" id="weeks"> <div class="tab" id="weeks">
<table class="striped"> <table class="weeks striped">
<tr> <tr>
<th>Name</th> <th class="name">Name</th>
<th>Start date</th> <th class="date">Start date</th>
<th>Map1</th> <th class="map1">Map1</th>
<th>Map2</th> <th class="map2">Map2</th>
<th>Options</th> <th class="actions"></th>
</tr> </tr>
<% @contest.weeks.each do |week| %> <% @contest.weeks.each do |week| %>
@ -212,7 +212,7 @@
<td><%= week.start_date.strftime("%d %B %y") %></td> <td><%= week.start_date.strftime("%d %B %y") %></td>
<td><%= h week.map1 %></td> <td><%= h week.map1 %></td>
<td><%= h week.map2 %></td> <td><%= h week.map2 %></td>
<td> <td class="actions">
<%= link_to icon('pencil'), edit_week_path(week) %> <%= link_to icon('pencil'), edit_week_path(week) %>
<%= link_to icon('times'), week, confirm: 'Are you sure?', method: :delete %> <%= link_to icon('times'), week, confirm: 'Are you sure?', method: :delete %>
</td> </td>
@ -224,12 +224,12 @@
</div> </div>
<div class="tab" id="matches"> <div class="tab" id="matches">
<table class="striped"> <table class="matches striped">
<tr> <tr>
<th>Teams</th> <th class="team">Teams</th>
<th>Date</th> <th class="date">Date</th>
<th>Score</th> <th class="score">Score</th>
<th>Options</th> <th class="actions"></th>
</tr> </tr>
<% @contest.matches.each do |match| %> <% @contest.matches.each do |match| %>
@ -247,7 +247,7 @@
<b><%= h match.score1 %> - <%= h match.score2 %></b> <b><%= h match.score1 %> - <%= h match.score2 %></b>
<% end %> <% end %>
</td> </td>
<td> <td class="actions">
<%= link_to icon('flag-checkered'), controller: :matches, action: :ref, id: match %> <%= link_to icon('flag-checkered'), controller: :matches, action: :ref, id: match %>
<%= link_to icon('pencil'), edit_match_path(match) %> <%= link_to icon('pencil'), edit_match_path(match) %>
<%= link_to icon('times'), match, confirm: 'Are you sure?', method: :delete %> <%= link_to icon('times'), match, confirm: 'Are you sure?', method: :delete %>

View file

@ -1,82 +1,73 @@
<h1>Listing Contests</h1> <h1 class="title">Listing Contests</h1>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<%= link_to 'New Contest', new_contest_path %> <%= link_to 'New Contest', new_contest_path, class: 'button' %>
<% end %> <% end %>
<h2>Current Contests</h2> <div id="contests">
<table class="data"> <div class="current">
<h3 class="title">Current Contests</h3>
<table class="current striped">
<tr> <tr>
<th>Name</th> <th class="name">Name</th>
<th>Start</th> <th class="date">Start</th>
<th>End</th> <th class="status">Status</th>
<th>Rules</th>
<th>Status</th>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<th>Options</th> <th class="actions"></th>
<% end %> <% end %>
</tr> </tr>
<% @contests_active.each do |contest| %> <% @contests_active.each do |contest| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= link_to (h contest.name), contest %></td> <td><%= link_to (h contest.name), contest %></td>
<td><%= longtime contest.start %></td> <td><%= longdate contest.start %></td>
<td><%= longtime contest.end %></td>
<% if contest.rules and contest.rules.title then %>
<td><%= link_to (h contest.rules.title), contest.rules %></td>
<% else %>
<td><%= "No ruleset specified" %></td>
<% end %>
<td><%= contest.statuses[contest.status] %></td> <td><%= contest.statuses[contest.status] %></td>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<td> <td class="actions">
<%= link_to 'Edit', edit_contest_path(contest) %> <%= link_to icon('pencil'), edit_contest_path(contest) %>
<%= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), contest, confirm: 'Are you sure?', method: :delete %>
</td> </td>
<% end %> <% end %>
</tr> </tr>
<% end %> <% end %>
</table> </table>
</div>
<h2>Previous Contests</h2> <div class="previous">
<table class="data"> <h3 class="title">Previous Contests</h3>
<table class="previous striped">
<tr> <tr>
<th>Name</th> <th class="name">Name</th>
<th>Start</th> <th class="date">Date</th>
<th>End</th> <th class="winner">Winner</th>
<th width="1%">Winner</th>
<th></th>
<th>Status</th>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<th>Options</th> <th class="actions"></th>
<% end %> <% end %>
</tr> </tr>
<% @contests_inactive.reverse_each do |contest| %> <% @contests_inactive.reverse_each do |contest| %>
<tr class="<%= cycle('even', 'odd') %>" height="18"> <tr>
<td><%= link_to (h contest.name), contest %></td> <td><%= link_to (h contest.name), contest %></td>
<td><%= longtime contest.start %></td> <td><%= longdate contest.start %></td>
<td><%= longtime contest.end %></td>
<% if contest.winner then %> <% if contest.winner then %>
<td><%= flag contest.winner.team.country %></td> <td><%= flag contest.winner.team.country %> <%= link_to (h contest.winner.team.name), contest.winner %></td>
<td><%= link_to (h contest.winner.team.name), contest.winner %></td>
<% else %> <% else %>
<td><%= %></td> <td></td>
<td><%= %></td>
<% end %> <% end %>
<td><%= contest.statuses[contest.status] %></td>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<td> <td class="actions">
<%= link_to 'Edit', edit_contest_path(contest) %> <%= link_to icon('pencil'), edit_contest_path(contest) %>
<%= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), contest, confirm: 'Are you sure?', method: :delete %>
</td> </td>
<% end %> <% end %>
</tr> </tr>
<% end %> <% end %>
</table> </table>
</div>
<br />
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<%= link_to 'New Contest', new_contest_path %> <%= link_to 'New Contest', new_contest_path, class: 'button' %>
<% end %> <% end %>
</div>

View file

@ -1,36 +1,33 @@
<h1>New Contest</h1> <h1>New Contest</h1>
<div class="box wide"> <%= form_for @contest, html: { class: 'square' } do |f| %>
<%= form_for @contest do |f| %> <%= render 'shared/errors', messages: @contest.errors.full_messages %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :contest_type %><br />
<%= f.select :contest_type, @contest.types.invert %>
</p>
<p>
<%= f.label :start %><br />
<%= f.datetime_select :start %>
</p>
<p>
<%= f.label :end %><br />
<%= f.datetime_select :end %>
</p>
<p>
<%= f.label :status %><br />
<%= f.select :status, @contest.statuses.invert %>
</p>
<p>
<%= f.label :default_time %><br />
<%= f.time_select :default_time %>
</p>
<p>
<%= f.submit 'Save' %>
</p>
<% end %>
</div>
<%= link_to 'Back', contests_path %> <div class="fields horizontal">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div class="fields horizontal">
<%= f.label :contest_type %>
<%= f.select :contest_type, @contest.types.invert %>
</div>
<div class="fields horizontal">
<%= f.label :start %>
<%= f.datetime_select :start, datetime_separator: '', time_separator: '' %>
</div>
<div class="fields horizontal">
<%= f.label :end %>
<%= f.datetime_select :end, datetime_separator: '', time_separator: '' %>
</div>
<div class="fields horizontal">
<%= f.label :status %>
<%= f.select :status, @contest.statuses.invert %>
</div>
<div class="fields horizontal">
<%= f.label :default_time %>
<%= f.time_select :default_time, time_separator: '' %>
</div>
<div class="controls">
<%= f.submit 'Save' %>
</div>
<% end %>

View file

@ -1,46 +1,50 @@
<h1>Gather Archive</h1> <h1>Gather Archive</h1>
<h3>Players in bold were captains for their respective teams.</h3> <h5 class="title">Players in bold were captains for their respective teams.</h5>
<table class="data"> <table class="gathers striped">
<tr> <tr>
<th>Date</th> <th class="date">Date</th>
<th>Team1</th> <th class="team1">Team 1</th>
<th>Team2</th> <th class="team2">Team 2</th>
<th>Map</th>
<th>Server</th>
</tr> </tr>
<% @gathers.each do |gather| %> <% @gathers.each do |gather| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr class="<%= cycle('even', 'odd') %>">
<td><%= link_to gather.updated_at.strftime("%Y/%m/%d %H:%M:%S"), gather %></td> <td><%= link_to gather.updated_at.strftime("%Y/%m/%d %H:%M:%S"), gather %></td>
<td> <td>
<ul>
<% gather.gatherers.each do |gatherer| %> <% gather.gatherers.each do |gatherer| %>
<li>
<% if gatherer.team == 1 %> <% if gatherer.team == 1 %>
<% if gather.captain1 == gatherer %> <% if gather.captain1 == gatherer %>
<b> <strong>
<% end %> <% end %>
<%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %> <%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %>
<% if gather.captain1 == gatherer %> <% if gather.captain1 == gatherer %>
</b> </strong>
<% end %> <% end %>
<% end %> <% end %>
</li>
<% end %> <% end %>
</ul>
</td> </td>
<td> <td>
<ul>
<% gather.gatherers.each do |gatherer| %> <% gather.gatherers.each do |gatherer| %>
<li>
<% if gatherer.team == 2 %> <% if gatherer.team == 2 %>
<% if gather.captain2 == gatherer %> <% if gather.captain2 == gatherer %>
<b> <strong>
<% end %> <% end %>
<%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %> <%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %>
<% if gather.captain2 == gatherer %> <% if gather.captain2 == gatherer %>
</b> </strong>
<% end %> <% end %>
<% end %> <% end %>
</li>
<% end %> <% end %>
</ul>
</td> </td>
<td><%= gather.map1 %></td>
<td><%= gather.server %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View file

@ -3,6 +3,7 @@ en:
articles_article_views: "Views" articles_article_views: "Views"
bans_create: "Ban was successfully created." bans_create: "Ban was successfully created."
bans_update: "Ban was successfully updated." bans_update: "Ban was successfully updated."
brackets_update: "Bracket was successfully updated."
articles_create: "Article was successfully created." articles_create: "Article was successfully created."
articles_update: "Article was successfully updated." articles_update: "Article was successfully updated."
articles_revert: "Article reverted to version: {{version}}" articles_revert: "Article reverted to version: {{version}}"