diff --git a/app/assets/stylesheets/components/_gather.scss b/app/assets/stylesheets/components/_gather.scss index ddc58ff..df7e003 100644 --- a/app/assets/stylesheets/components/_gather.scss +++ b/app/assets/stylesheets/components/_gather.scss @@ -188,3 +188,19 @@ margin-left: - em(20); width: $max-width + $container-padding*2; } + +/* + Gather Archive +*/ + +table.gathers { + + .date { + width: 30%; + } + + .team1, + .team2 { + width: 35%; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/pages/_contests.scss b/app/assets/stylesheets/pages/_contests.scss index 4731663..ff2f5ba 100644 --- a/app/assets/stylesheets/pages/_contests.scss +++ b/app/assets/stylesheets/pages/_contests.scss @@ -129,6 +129,10 @@ table.brackets { table { margin: 0; } + + > a { + padding-left: em(10); + } } .bracket { @@ -190,4 +194,142 @@ table.brackets { text-align: right; } } +} + +/* + 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; + } + } + } } \ No newline at end of file diff --git a/app/controllers/brackets_controller.rb b/app/controllers/brackets_controller.rb index 374199f..3504d20 100644 --- a/app/controllers/brackets_controller.rb +++ b/app/controllers/brackets_controller.rb @@ -3,6 +3,7 @@ class BracketsController < ApplicationController def edit raise AccessError unless @bracket.can_update? cuser + render layout: 'full' end def create diff --git a/app/views/brackets/edit.html.erb b/app/views/brackets/edit.html.erb index 6fd1526..09c3a08 100644 --- a/app/views/brackets/edit.html.erb +++ b/app/views/brackets/edit.html.erb @@ -1,28 +1,18 @@ -

- Editing bracket -

+

Editing Bracket

<%= form_for(@bracket) do |f| %> -
- + <%= render 'shared/errors', messages: @bracket.errors.full_messages %> + +
+ <%= f.label :slots %> + <%= f.text_field :slots %>
-

- <%= f.label :slots %>
- <%= f.text_field :slots %> -

+ <%= render partial: "bracket", locals: { bracket: @bracket } %> - <%= render :partial => "bracket", :locals => {:bracket => @bracket} %> - -

+

<%= f.submit 'Update' %> -

+
<% end %>
- -<%= link_to 'Back', edit_contest_path(@bracket.contest) %> diff --git a/app/views/contests/_bracket.html.erb b/app/views/contests/_bracket.html.erb index 2fc2dfa..47a62aa 100644 --- a/app/views/contests/_bracket.html.erb +++ b/app/views/contests/_bracket.html.erb @@ -23,8 +23,8 @@ <% end %> -<%= render :partial => "brackets/bracket", :collection => contest.brackets %> +<%= render partial: "brackets/bracket", collection: contest.brackets %> <% 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 %> diff --git a/app/views/contests/edit.html.erb b/app/views/contests/edit.html.erb index f626671..a3af0fb 100644 --- a/app/views/contests/edit.html.erb +++ b/app/views/contests/edit.html.erb @@ -1,6 +1,6 @@

Editing Contest

-
+
  • General
  • <% if @contest.contest_type == Contest::TYPE_BRACKET %> @@ -85,18 +85,18 @@ <% if @contest.contest_type == Contest::TYPE_BRACKET %>
    - +
    - - - + + + <% @contest.brackets.each do |bracket| %> - @@ -121,18 +121,18 @@ <% end %>
    -
    BracketSlotsOptionsBracketSlots
    <%= namelink bracket %> <%= bracket.slots %> + <%= link_to icon('pencil'), edit_bracket_path(bracket) %> <%= link_to icon('times'), bracket, confirm: 'Are you sure?', method: :delete %>
    +
    - - - + + + <% @contest.maps.basic.each do |map| %> - @@ -153,12 +153,12 @@
    -
    NameDownloadOptionsNameDownload
    <%= namelink map %> <%= h map.download %> + <%= link_to icon('pencil'), edit_map_path(map) %> <%= link_to icon('times'), action: "del_map", id: @contest.id, id2: map.id %>
    +
    - - - - + + + + <% @contest.contesters.each do |contester| %> @@ -166,7 +166,7 @@ -
    TeamScoreStatusActionsTeamScoreStatus
    <%= link_to (h contester.team), contester %> <%= h contester.score %> <%= contester.statuses[contester.active] %> + <% if contester.active %> <%= link_to icon('pencil'), edit_contester_path(contester) %> <%= link_to icon('times'), contester, confirm: 'Are you sure?', method: :delete %> @@ -197,13 +197,13 @@
    - +
    - - - - - + + + + + <% @contest.weeks.each do |week| %> @@ -212,7 +212,7 @@ - @@ -224,12 +224,12 @@
    -
    NameStart dateMap1Map2OptionsNameStart dateMap1Map2
    <%= week.start_date.strftime("%d %B %y") %> <%= h week.map1 %> <%= h week.map2 %> + <%= link_to icon('pencil'), edit_week_path(week) %> <%= link_to icon('times'), week, confirm: 'Are you sure?', method: :delete %>
    +
    - - - - + + + + <% @contest.matches.each do |match| %> @@ -247,7 +247,7 @@ <%= h match.score1 %> - <%= h match.score2 %> <% end %> -
    TeamsDateScoreOptionsTeamsDateScore
    + <%= link_to icon('flag-checkered'), controller: :matches, action: :ref, id: match %> <%= link_to icon('pencil'), edit_match_path(match) %> <%= link_to icon('times'), match, confirm: 'Are you sure?', method: :delete %> diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 650150b..1d464cb 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -1,82 +1,73 @@ -

    Listing Contests

    +

    Listing Contests

    <% if cuser and cuser.admin? %> - <%= link_to 'New Contest', new_contest_path %> + <%= link_to 'New Contest', new_contest_path, class: 'button' %> <% end %> -

    Current Contests

    - - - - - - - - <% if cuser and cuser.admin? %> - - <% end %> - +
    +
    +

    Current Contests

    - <% @contests_active.each do |contest| %> -
    - - - - <% if contest.rules and contest.rules.title then %> - - <% else %> - +
    NameStartEndRulesStatusOptions
    <%= link_to (h contest.name), contest %><%= longtime contest.start %><%= longtime contest.end %><%= link_to (h contest.rules.title), contest.rules %><%= "No ruleset specified" %>
    + + + + + <% if cuser and cuser.admin? %> + + <% end %> + + + <% @contests_active.each do |contest| %> + + + + + <% if cuser and cuser.admin? %> + + <% end %> + <% end %> - - <% if cuser and cuser.admin? %> - +
    NameStartStatus
    <%= link_to (h contest.name), contest %><%= longdate contest.start %><%= contest.statuses[contest.status] %> + <%= link_to icon('pencil'), edit_contest_path(contest) %> + <%= link_to icon('times'), contest, confirm: 'Are you sure?', method: :delete %> +
    <%= contest.statuses[contest.status] %> - <%= link_to 'Edit', edit_contest_path(contest) %> - <%= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete %> -
    + + + + + <% if cuser and cuser.admin? %> + <%= link_to 'New Contest', new_contest_path, class: 'button' %> <% end %> -
    - -

    Previous Contests

    - - - - - - - - - <% if cuser and cuser.admin? %> - - <% end %> - - - <% @contests_inactive.reverse_each do |contest| %> - - - - - <% if contest.winner then %> - - - <% else %> - - - <% end %> - - <% if cuser and cuser.admin? %> - - <% end %> - - <% end %> -
    NameStartEndWinnerStatusOptions
    <%= link_to (h contest.name), contest %><%= longtime contest.start %><%= longtime contest.end %><%= flag contest.winner.team.country %><%= link_to (h contest.winner.team.name), contest.winner %><%= %><%= %><%= contest.statuses[contest.status] %> - <%= link_to 'Edit', edit_contest_path(contest) %> - <%= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete %> -
    - -
    - -<% if cuser and cuser.admin? %> - <%= link_to 'New Contest', new_contest_path %> -<% end %> +
    \ No newline at end of file diff --git a/app/views/contests/new.html.erb b/app/views/contests/new.html.erb index 3537326..5ee5cd1 100644 --- a/app/views/contests/new.html.erb +++ b/app/views/contests/new.html.erb @@ -1,36 +1,33 @@

    New Contest

    -
    - <%= form_for @contest do |f| %> - <%= f.error_messages %> -

    - <%= f.label :name %>
    - <%= f.text_field :name %> -

    -

    - <%= f.label :contest_type %>
    - <%= f.select :contest_type, @contest.types.invert %> -

    -

    - <%= f.label :start %>
    - <%= f.datetime_select :start %> -

    -

    - <%= f.label :end %>
    - <%= f.datetime_select :end %> -

    -

    - <%= f.label :status %>
    - <%= f.select :status, @contest.statuses.invert %> -

    -

    - <%= f.label :default_time %>
    - <%= f.time_select :default_time %> -

    -

    - <%= f.submit 'Save' %> -

    - <% end %> -
    +<%= form_for @contest, html: { class: 'square' } do |f| %> + <%= render 'shared/errors', messages: @contest.errors.full_messages %> -<%= link_to 'Back', contests_path %> +
    + <%= f.label :name %> + <%= f.text_field :name %> +
    +
    + <%= f.label :contest_type %> + <%= f.select :contest_type, @contest.types.invert %> +
    +
    + <%= f.label :start %> + <%= f.datetime_select :start, datetime_separator: '', time_separator: '' %> +
    +
    + <%= f.label :end %> + <%= f.datetime_select :end, datetime_separator: '', time_separator: '' %> +
    +
    + <%= f.label :status %> + <%= f.select :status, @contest.statuses.invert %> +
    +
    + <%= f.label :default_time %> + <%= f.time_select :default_time, time_separator: '' %> +
    +
    + <%= f.submit 'Save' %> +
    +<% end %> diff --git a/app/views/gathers/index.html.erb b/app/views/gathers/index.html.erb index 16cd2e7..01d4223 100644 --- a/app/views/gathers/index.html.erb +++ b/app/views/gathers/index.html.erb @@ -1,46 +1,50 @@

    Gather Archive

    -

    Players in bold were captains for their respective teams.

    +
    Players in bold were captains for their respective teams.
    - +
    - - - - - + + + <% @gathers.each do |gather| %> - - <% end %>
    DateTeam1Team2MapServerDateTeam 1Team 2
    <%= link_to gather.updated_at.strftime("%Y/%m/%d %H:%M:%S"), gather %> - <% gather.gatherers.each do |gatherer| %> - <% if gatherer.team == 1 %> - <% if gather.captain1 == gatherer %> - +
      + <% gather.gatherers.each do |gatherer| %> +
    • + <% if gatherer.team == 1 %> + <% if gather.captain1 == gatherer %> + + <% end %> + <%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %> + <% if gather.captain1 == gatherer %> + + <% end %> <% end %> - <%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %> - <% if gather.captain1 == gatherer %> - - <% end %> +
    • <% end %> - <% end %> +
    - <% gather.gatherers.each do |gatherer| %> - <% if gatherer.team == 2 %> - <% if gather.captain2 == gatherer %> - +
      + <% gather.gatherers.each do |gatherer| %> +
    • + <% if gatherer.team == 2 %> + <% if gather.captain2 == gatherer %> + + <% end %> + <%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %> + <% if gather.captain2 == gatherer %> + + <% end %> <% end %> - <%= link_to gatherer.user.to_s, User.find_by_username(gatherer.user.to_s) %> - <% if gather.captain2 == gatherer %> - - <% end %> +
    • <% end %> - <% end %> +
    <%= gather.map1 %><%= gather.server %>
    diff --git a/config/locales/en.yml b/config/locales/en.yml index a2f52c5..f0ab818 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,7 @@ en: articles_article_views: "Views" bans_create: "Ban was successfully created." bans_update: "Ban was successfully updated." + brackets_update: "Bracket was successfully updated." articles_create: "Article was successfully created." articles_update: "Article was successfully updated." articles_revert: "Article reverted to version: {{version}}"