diff --git a/.env.example b/.env.example index 2d588bb..d65034c 100644 --- a/.env.example +++ b/.env.example @@ -4,11 +4,12 @@ APP_SECRET= DEPLOY_PATH= -UNICORN_USER=deploy -UNICORN_GROUP=deploy -UNICORN_WORKERS=4 -UNICORN_PORT=4000 -UNICORN_SOCKET=/tmp/unicorn.ensl.sock +PUMA_WORKERS=1 +PUMA_MIN_THREADS=1 +PUMA_MAX_THREADS=16 +PUMA_PORT=4000 +PUMA_SOCKET=/tmp/ensl.sock +PUMA_TIMEOUT=30 MYSQL_DATABASE=ensl MYSQL_USERNAME= diff --git a/Capfile b/Capfile index 1626739..e429c17 100644 --- a/Capfile +++ b/Capfile @@ -3,6 +3,5 @@ require 'capistrano/deploy' require 'capistrano/rbenv' require 'capistrano/bundler' require 'capistrano/rails' -require 'capistrano3/unicorn' Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } diff --git a/Gemfile b/Gemfile index afac3de..91caf20 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem 'dotenv-rails', '~> 0.10.0' gem 'rails', '~> 3.2.17' gem 'mysql2', '~> 0.3.15' gem 'dalli', '~> 2.7.0' +gem 'puma', '~> 2.8.2' gem 'exceptional', '~> 2.0.33' gem 'oj', '~> 2.5.5' @@ -34,7 +35,6 @@ gem 'sass-rails', '~> 3.2.6' gem 'font-awesome-sass', '~> 4.0.3.1' gem 'bourbon', '~> 3.1.8' gem 'neat', '~> 1.6.0' -gem 'bitters', '~> 0.9.3' group :assets do gem 'uglifier', '~> 2.5.0' @@ -45,7 +45,6 @@ group :development do gem 'capistrano-rbenv', '~> 2.0.2' gem 'capistrano-bundler', '~> 1.1.2' gem 'capistrano-rails', '~> 1.1' - gem 'capistrano3-unicorn', '~> 0.1.1' gem 'better_errors', '~> 1.1.0' gem 'binding_of_caller', '~> 0.7.2' gem 'annotate', '~> 2.6.2' @@ -67,8 +66,3 @@ end group :development, :test do gem 'pry-debugger', '~> 0.2.2' end - -group :staging, :production do - gem 'kgio', '~> 2.9.2' - gem 'unicorn', '~> 4.8.2' -end diff --git a/Gemfile.lock b/Gemfile.lock index dc86ebb..39f6e75 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,10 +40,6 @@ GEM erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bitters (0.9.3) - bourbon (>= 3.1) - sass (>= 3.2) - thor bluecloth (2.2.0) bourbon (3.1.8) sass (>= 3.2.0) @@ -62,8 +58,6 @@ GEM capistrano-rbenv (2.0.2) capistrano (~> 3.1) sshkit (~> 1.3) - capistrano3-unicorn (0.1.1) - capistrano (>= 3.1.0) capybara (2.2.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -129,7 +123,6 @@ GEM railties (>= 3.2.0, < 5.0) thor (~> 0.14) json (1.8.1) - kgio (2.9.2) libv8 (3.16.14.3) mail (2.5.4) mime-types (~> 1.16) @@ -170,6 +163,8 @@ GEM pry-debugger (0.2.2) debugger (~> 1.3) pry (~> 0.9.10) + puma (2.8.2) + rack (>= 1.1, < 2.0) quiet_assets (1.0.2) railties (>= 3.1, < 5.0) rack (1.4.5) @@ -194,7 +189,6 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - raindrops (0.13.0) rake (10.1.1) rdoc (3.12.2) json (~> 1.4) @@ -257,10 +251,6 @@ GEM uglifier (2.5.0) execjs (>= 0.3.0) json (>= 1.8.0) - unicorn (4.8.2) - kgio (~> 2.6) - rack - raindrops (~> 0.7) websocket (1.0.7) websocket-driver (0.3.2) will_paginate (3.0.5) @@ -278,14 +268,12 @@ DEPENDENCIES bbcoder (~> 1.0.1) better_errors (~> 1.1.0) binding_of_caller (~> 0.7.2) - bitters (~> 0.9.3) bluecloth (~> 2.2.0) bourbon (~> 3.1.8) capistrano (~> 3.1.0) capistrano-bundler (~> 1.1.2) capistrano-rails (~> 1.1) capistrano-rbenv (~> 2.0.2) - capistrano3-unicorn (~> 0.1.1) capybara (~> 2.2.1) carrierwave (~> 0.10.0) codeclimate-test-reporter (~> 0.3.0) @@ -301,7 +289,6 @@ DEPENDENCIES font-awesome-sass (~> 4.0.3.1) gruff (~> 0.3.6) jquery-rails (~> 2.0.2) - kgio (~> 2.9.2) mysql2 (~> 0.3.15) neat (~> 1.6.0) newrelic_rpm (~> 3.7.2.195) @@ -309,6 +296,7 @@ DEPENDENCIES oj (~> 2.5.5) poltergeist (~> 1.5.0) pry-debugger (~> 0.2.2) + puma (~> 2.8.2) quiet_assets (~> 1.0.2) rails (~> 3.2.17) rmagick (~> 2.13.2) @@ -323,5 +311,4 @@ DEPENDENCIES timecop (~> 0.7.1) tinymce-rails (~> 3.5.9) uglifier (~> 2.5.0) - unicorn (~> 4.8.2) will_paginate (~> 3.0.5) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 093c2ff..5971be2 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -9,5 +9,21 @@ //= require_self $ -> - $("#logout").click -> - $(this).closest("form").submit() \ No newline at end of file + $('logout').click -> + $(this).closest('form').submit() + + $('select').each (i, el) -> + $select = $(el) + + $select.wrap '
' + $select.on 'DOMSubtreeModified', (event) -> + $el = $(this) + $wrapper = $el.parent() + + if $el.is("[disabled]") + $wrapper.addClass 'disabled' + else + $wrapper.removeClass 'disabled' + + $select.trigger 'DOMSubtreeModified' + \ No newline at end of file diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js index f1e4c06..427e4ee 100644 --- a/app/assets/javascripts/local.js +++ b/app/assets/javascripts/local.js @@ -105,13 +105,13 @@ $(document).ready(function(){ }); }); -$( function() { +$(function() { var menuContests; var menuGather; var menuMaterial; var menuForums; - $( function() { + $(function() { $('div#indexMenu div.contests').hover(function(){ }); }); @@ -123,8 +123,8 @@ $( function() { // Gather stuff - $("a#gatherInfoHide").live('click', function() { - $("div#gatherInfo").fadeOut('slow', 0); + $("a#gather-info-hide").live('click', function() { + $("div#gather-info").fadeOut('slow', 0); }); $("a#gatherJoinBtn").live('click', function() { diff --git a/app/assets/stylesheets/_variables.scss b/app/assets/stylesheets/_variables.scss index 9ab65f4..b25a6be 100644 --- a/app/assets/stylesheets/_variables.scss +++ b/app/assets/stylesheets/_variables.scss @@ -23,8 +23,9 @@ $large-screen-up: new-breakpoint(min-width $large-screen 8); Typography */ -$open-sans: "Open Sans", sans-serif; -$montserrat: "Montserrat", sans-serif; +$open-sans: 'Open Sans', sans-serif; +$montserrat: 'Montserrat', sans-serif; +$fontawesome: 'FontAwesome'; $sans-serif: $open-sans; $base-font-family: $sans-serif; @@ -91,6 +92,7 @@ $flash-success: #1f7f5c; $flash-warning: $red; $flash-error: #e56c69; +$input-font-size: em(16); $input-primary: white; $input-secondary: #5a9aa8; $input-text: #232323; diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 2f0d4e8..6e00626 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -27,6 +27,7 @@ @import "components/breadcrumbs"; @import "components/pagination"; @import "components/tabs"; +@import "components/shoutbox"; /* Layout diff --git a/app/assets/stylesheets/components/_forms.scss b/app/assets/stylesheets/components/_forms.scss index 25c04ac..31acc1e 100644 --- a/app/assets/stylesheets/components/_forms.scss +++ b/app/assets/stylesheets/components/_forms.scss @@ -6,8 +6,8 @@ form { .fields { > .field_with_errors:first-child, > label { - padding: 11px 0; - line-height: 16px; + padding: em(11) 0; + line-height: em(16); } > .field_with_errors { @@ -27,11 +27,68 @@ form { } } - input, + .select-wrapper { + $select-padding: em(4); + + background-color: $input-primary; + border: $input-border-colour solid $input-border-width; + position: relative; + display: inline-block; + margin-right: em(10); + + select { + @include appearance(none); + font-size: $input-font-size; + font-family: $open-sans; + float: left; + display: block; + width: auto; + position: relative; + margin-left: 0; + border: 0; + padding: $select-padding em(45) $select-padding $input-padding; + font-size: $input-font-size; + + option { + font-size: $input-font-size; + } + + &:focus { + outline: none; + } + } + + &:after { + font-family: $fontawesome; + pointer-events: none; + content: $fa-var-chevron-down; + font-weight: normal; + font-style: normal; + position: absolute; + top: em(5); + right: $input-padding; + padding-left: $input-padding; + border-left: em(1) solid lighten($input-secondary, 20%); + } + + &:hover { + border: $input-border-width solid lighten($input-secondary, 20%); + } + + &:focus { + border: $input-border-width solid $input-secondary; + color: $input-secondary; + background: transparent; + } + } + + input[type=text], + input[type=password], + input[type=email], textarea { background-color: $input-primary; color: $input-text; - font-size: em(16); + font-size: $input-font-size; padding: $input-padding; height: em(40); border: $input-border-colour solid $input-border-width; @@ -48,6 +105,41 @@ form { } } + input[type=checkbox] { + @include appearance(none); + width: em(40); + height: em(40); + font-size: $input-font-size; + padding: $input-padding; + background-color: $input-primary; + border: $input-border-colour solid $input-border-width; + position: relative; + margin: 0; + float: left; + + &:focus { + outline: none; + } + + &:hover { + cursor: pointer; + } + + &:checked { + &:after { + content: $fa-var-check; + pointer-events: none; + font-family: $fontawesome; + font-weight: normal; + font-style: normal; + position: absolute; + font-size: em(22); + top: em(4); + left: em(5); + } + } + } + textarea { height: auto; width: 100%; @@ -58,7 +150,7 @@ form { margin-bottom: em(20); button, - input { + input[type=submit] { @include button($button-secondary); margin-bottom: 0; outline: none; @@ -127,7 +219,10 @@ form.square { line-height: em(16); } - input, + .inputs, + input[type=text], + input[type=password], + input[type=email], textarea { @include span-columns(9); } @@ -158,4 +253,4 @@ form.search { width: 100%; } } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/components/_gather.scss b/app/assets/stylesheets/components/_gather.scss index 00aecaa..19d41d9 100644 --- a/app/assets/stylesheets/components/_gather.scss +++ b/app/assets/stylesheets/components/_gather.scss @@ -1,8 +1,167 @@ +/* + Gather Page +*/ + +#gather { + @include span-columns(12); + + .previous a, + .next a { + display: inline-block; + float: none; + margin: 0; + + i { + vertical-align: middle; + } + } + + .previous { + @include span-columns(6); + + i { + margin-right: em(10); + } + } + + .next { + @include span-columns(6); + @include omega; + text-align: right; + + i { + margin-left: em(10); + } + } + + .shoutbox-messages { + @include span-columns(12); + + .timestamp { + margin: 0 em(5) em(5); + } + } + + .new-shout { + @include span-columns(12); + margin: em(20) 0; + + .shout_input { + width: em(400); + margin-right: em(20); + } + + .fields, + .controls { + float: left; + display: block; + } + } +} + +#gather-info { + @include span-columns(12); + margin: em(20) 0; + border-bottom: em(2) solid $light-gray; + + .info { + @include span-columns(4); + + h6 { + margin-bottom: em(10); + } + + &:nth-child(3) { + @include omega; + } + } + + ul { + list-style-type: disc; + + li { + margin-left: em(20); + } + } + + .hide { + @include span-columns(12); + padding: em(20) 0; + text-align: center; + + a { + display: inline-block; + float: none; + + i { + margin-right: em(10); + } + } + } +} + +#gather-area { + @include span-columns(12); + margin-top: em(20); + + .data { + @include span-columns(4); + max-height: em(400); + overflow-y: scroll; + padding-bottom: em(20); + + h4 { + padding-bottom: em(20); + } + + &:nth-child(3) { + @include omega; + } + + ul { + margin-bottom: em(10); + + li { + margin-bottom: em(5); + } + } + } + + .players { + + .captain { + color: $gold; + margin: 0 em(10); + } + + .delete { + display: inline-block; + padding: 0 em(10); + } + } +} + +#gather-stats { + @include span-columns(12); + padding: em(20) 0; + margin: em(20) 0; + border-top: em(2) solid $light-gray; + border-bottom: em(2) solid $light-gray; + position: relative; + + .admin { + top: em(20); + right: 0; + margin: 0; + position: absolute; + } +} + /* Gather Status */ -#gather { +#gather-status { @include span-columns(12); @include flash; diff --git a/app/assets/stylesheets/components/_shoutbox.scss b/app/assets/stylesheets/components/_shoutbox.scss new file mode 100644 index 0000000..519aeea --- /dev/null +++ b/app/assets/stylesheets/components/_shoutbox.scss @@ -0,0 +1,16 @@ +/* + Shoutbox Messages +*/ + +.shoutmsg { + margin-bottom: em(5); + + .timestamp { + font-size: em(14); + border-radius: em(3); + background: darken($light-blue, 10); + display: inline-block; + font-style: italic; + padding: 0 em(6); + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/components/_tabs.scss b/app/assets/stylesheets/components/_tabs.scss index 3843abc..368a77d 100644 --- a/app/assets/stylesheets/components/_tabs.scss +++ b/app/assets/stylesheets/components/_tabs.scss @@ -1,5 +1,5 @@ /* - Breadcrumbs + Tabs */ .tabbed { diff --git a/app/assets/stylesheets/layout/_body.scss b/app/assets/stylesheets/layout/_body.scss index b6ad05b..5f90123 100644 --- a/app/assets/stylesheets/layout/_body.scss +++ b/app/assets/stylesheets/layout/_body.scss @@ -64,7 +64,7 @@ h1, h2, h3, h4, h5, h6 { &:before { content: ""; display: block; - border-top: 2px solid $blue; + border-top: 2px solid $light-gray; width: 100%; height: 2px; position: absolute; diff --git a/app/assets/stylesheets/pages/_contests.scss b/app/assets/stylesheets/pages/_contests.scss index 2bf47bc..856dd07 100644 --- a/app/assets/stylesheets/pages/_contests.scss +++ b/app/assets/stylesheets/pages/_contests.scss @@ -1,3 +1,16 @@ +/* + Contester +*/ + +#matches { + @include span-columns(12); + margin: em(20) 0; +} + +/* + Contest List +*/ + table.contest { margin-bottom: em(40); @@ -50,6 +63,10 @@ table.contest { } } +/* + Brackets +*/ + table.brackets { margin: em(20) 0 em(40) 0; width: auto; @@ -101,4 +118,4 @@ table.brackets { > tbody > tr > td { width: em(150); } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/pages/_matches.scss b/app/assets/stylesheets/pages/_matches.scss index b999667..ac8c637 100644 --- a/app/assets/stylesheets/pages/_matches.scss +++ b/app/assets/stylesheets/pages/_matches.scss @@ -3,6 +3,8 @@ */ #matches { + width: 100%; + display: table; table-layout: auto; margin-bottom: em(20); diff --git a/app/assets/stylesheets/pages/_users.scss b/app/assets/stylesheets/pages/_users.scss index 557a12c..1f0f184 100644 --- a/app/assets/stylesheets/pages/_users.scss +++ b/app/assets/stylesheets/pages/_users.scss @@ -1,3 +1,7 @@ +/* + Users Listing +*/ + #users { table-layout: auto; @@ -18,4 +22,34 @@ .actions { text-align: right; } -} \ No newline at end of file +} + +/* + Profile +*/ + +#user { + @include span-columns(12); + + .tabbed-contents { + margin-bottom: em(20); + } +} + +#profile { + + .controls { + @include shift(0); + } + + .tab { + + h4 { + margin-bottom: 1em; + } + + .fields:last-child { + margin-bottom: 0; + } + } +} diff --git a/app/controllers/gathers_controller.rb b/app/controllers/gathers_controller.rb index b95bea0..79acc85 100644 --- a/app/controllers/gathers_controller.rb +++ b/app/controllers/gathers_controller.rb @@ -7,6 +7,7 @@ class GathersController < ApplicationController end def show + render layout: 'full' end def latest diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ce72e7e..e8b807f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -155,4 +155,8 @@ module ApplicationHelper event.start end end + + def latest_rules + Contest.last.rules + end end diff --git a/app/helpers/gathers_helper.rb b/app/helpers/gathers_helper.rb index 66463fa..90dbaee 100644 --- a/app/helpers/gathers_helper.rb +++ b/app/helpers/gathers_helper.rb @@ -1,18 +1,21 @@ module GathersHelper def render_gather if @gather.status == Gather::STATE_RUNNING - headers["Gather"] = "running" - render :partial => "running", :layout => false + headers['Gather'] = 'running' + + render partial: 'running', layout: false elsif @gather.status == Gather::STATE_VOTING - if @gatherer and @gather.gatherer_votes.first(:conditions => {:user_id => cuser.id}) - headers["Gather"] = "voted" + if @gatherer and @gather.gatherer_votes.first(conditions: { user_id: cuser.id }) + headers['Gather'] = 'voted' else - headers["Gather"] = "voting" + headers['Gather'] = 'voting' end - render :partial => "voting", :layout => false + + render partial: 'voting', layout: false elsif @gather.status == Gather::STATE_PICKING or @gather.status == Gather::STATE_FINISHED - headers["Gather"] = "picking" - render :partial => "picking", :layout => false + headers['Gather'] = 'picking' + + render partial: 'picking', layout: false end end end diff --git a/app/models/user.rb b/app/models/user.rb index e54396b..543ee4b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -163,7 +163,7 @@ class User < ActiveRecord::Base end def from - if profile.town.length > 0 + if profile.town && profile.town.length > 0 "#{profile.town}, #{country_s}" else "#{country_s}" diff --git a/app/views/application/_gather.html.erb b/app/views/application/_gather.html.erb index 06467ea..4a7e872 100644 --- a/app/views/application/_gather.html.erb +++ b/app/views/application/_gather.html.erb @@ -1,4 +1,4 @@ -
+
<% if cuser && (gather = cuser.gathers.active.ordered.first) %> <%= link_to t('gather.status.joined'), gather %> <% elsif Gather.last && (Gather::FULL - Gather.last.gatherers.count) == 12 %> diff --git a/app/views/application/_header.html.erb b/app/views/application/_header.html.erb index 9576d02..cfd0da1 100644 --- a/app/views/application/_header.html.erb +++ b/app/views/application/_header.html.erb @@ -23,7 +23,7 @@
  • <%= link_to "Staff", controller: "about", action: "staff" %>
  • <%= link_to "History", article_url(Article::HISTORY) %>
  • -
  • <%= link_to "Rules", article_url(Article::RULES) %>
  • +
  • <%= link_to "Rules", latest_rules %>
  • <%= link_to "Hall of Fame", article_url(Article::HOF) %>
  • <%= link_to "Bans", bans_url %>
  • <%= link_to "Contact", new_issue_path %>
  • diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 7959fc2..a55b407 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,6 +1,6 @@
    - <%= image_tag comment.user.profile.avatar.url, id: "user" %> + <%= image_tag comment.user.profile.avatar.url %>

    diff --git a/app/views/contesters/show.html.erb b/app/views/contesters/show.html.erb index a8364c2..25ced83 100644 --- a/app/views/contesters/show.html.erb +++ b/app/views/contesters/show.html.erb @@ -1,31 +1,33 @@ -
    -

    - <%= link_to (h @contester.team.name), team_url(@contester.team, :teamTab => "matches", :anchor => "contest_#{@contester.contest.id}") %> +
    +

    + + <%= link_to (h @contester.team.name), team_url(@contester.team, team: 'matches', anchor: "contest_#{@contester.contest.id}") %> +

    -

    - <%= namelink @contester.contest %> -

    + <% if @contester.team.logo %> - <%= image_tag @contester.team.logo.url, :class => "centered" %> + <% end %>
    -
    -
      +

      <%= namelink @contester.contest %>

      + +
      + -
      +
      - <%= render :partial => "matches/list", :locals => {:matches => @results, :friendly => @contester.team, :contest => false} %> + <%= render partial: 'matches/list', locals: { matches: @results, friendly: @contester.team, contest: false } %>
      -

      - Upcoming -

      +

      Upcoming

      @@ -48,35 +50,29 @@
      -

      - Rank -

      - +

      Rank

      <%= cascade @contester, ["total", "win", "loss", "draw"] %> <% if !@contester.active %> -

      - INACTIVE -

      +

      INACTIVE

      <% end %>
      -
      -

      - Members -

      - - <%= render :partial => "teamers/list", :locals => {:teamers => @members, :blacklist => nil, :comment => false} %> +
      +

      Members

      + <%= render partial: 'teamers/list', locals: { teamers: @members, blacklist: nil, comment: false } %>
      +<%= link_to 'Back', @contester.contest, class: 'button' %> + <% if @contester.can_update? cuser %> - <%= link_to 'Edit', edit_contester_path(@contester) %> | + <%= link_to 'Edit', edit_contester_path(@contester), class: 'button' %> <% end %> -<%= link_to 'Back', @contester.contest %> - diff --git a/app/views/contests/_normal.html.erb b/app/views/contests/_normal.html.erb index e77b952..f22ed59 100644 --- a/app/views/contests/_normal.html.erb +++ b/app/views/contests/_normal.html.erb @@ -1,7 +1 @@ -
      - <%= render :partial => "contesters/list", :locals => {:contesters => @contest.contesters.active.ordered, :actions => true} %> -
      - - +<%= render partial: 'contesters/list', locals: { contesters: @contest.contesters.active.ordered, actions: true } %> diff --git a/app/views/contests/show.html.erb b/app/views/contests/show.html.erb index f04c714..358f82c 100644 --- a/app/views/contests/show.html.erb +++ b/app/views/contests/show.html.erb @@ -2,24 +2,23 @@

      Details

      -

      - From-to:
      - <%= longdate @contest.start %>
      <%= longdate @contest.end %> -

      -

      - Rules:
      - <%= namelink @contest.rules %> -

      -

      - Status:
      - <%= @contest.statuses[@contest.status] %> -

      -

      - Default:
      - Sunday: <%= h @contest.default_time.strftime("%H:%M") %> -

      + +
      +
      Start - End
      +
      + <%= longdate @contest.start %>
      + <%= longdate @contest.end %> +
      +
      Rules
      +
      <%= namelink @contest.rules %>
      +
      Status
      +
      <%= @contest.statuses[@contest.status] %>
      +
      Default
      +
      Sunday: <%=h @contest.default_time.strftime("%H:%M") %>
      +
      + <% if @contest.contest_type == Contest::TYPE_LADDER %> - <%= link_to "Scoring", "/contests/#{@contest}/score" %> + <%= link_to 'Scoring', "/contests/#{@contest}/score" %> <% end %> <% if cuser and cuser.admin? %> <%= link_to 'Edit', edit_contest_path(@contest) %> @@ -27,19 +26,19 @@
      <% if @contest.contest_type == Contest::TYPE_BRACKET %> - <%= render :partial => "bracket", :locals => {:contest => @contest} %> + <%= render partial: 'bracket', locals: { contest: @contest } %> <% else %> - <%= render :partial => "normal" %> + <%= render partial: 'normal' %> <% end %> -
      -
        +
        + -
        +

        Matches Played @@ -172,5 +171,7 @@

        diff --git a/app/views/forums/new.html.erb b/app/views/forums/new.html.erb index 02d646b..b990650 100644 --- a/app/views/forums/new.html.erb +++ b/app/views/forums/new.html.erb @@ -1,5 +1,5 @@ -

        New forum

        +

        New Forum

        -<%= render :partial => "form" %> +<%= render partial: "form" %> -<%= link_to 'Back', forums_path %> \ No newline at end of file +<%= link_to 'Back', forums_path, class: 'button' %> \ No newline at end of file diff --git a/app/views/gatherers/_list.html.erb b/app/views/gatherers/_list.html.erb index c38480a..5131a12 100644 --- a/app/views/gatherers/_list.html.erb +++ b/app/views/gatherers/_list.html.erb @@ -1,32 +1,38 @@ <% captain = team == 1 ? @gather.captain1 : @gather.captain2 %> <% pick = false %> -

        +

        <%= if team.nil? then "Lobby" else team == 1 ? "Marines" : "Aliens" end %> -

        + - <%= form_tag("/gathers/pick/#{@gather.id}") do %> +<%= form_tag("/gathers/pick/#{@gather.id}") do %> +
          + <% @gather.gatherers.ordered.team(team).each do |gatherer| %> +
        • + <% if @gatherer and gatherer.can_update? cuser, { team: @gatherer.team } %> + <% pick = true %> + <%= radio_button_tag :player, gatherer.id %><%= flag gatherer.user.country %> + <%= namelink gatherer.user %> -
      - <% @gather.gatherers.ordered.team(team).each do |gatherer| %> - - <% if @gatherer and gatherer.can_update? cuser, {:team => @gatherer.team} %> - <% pick = true %> - - - <% else %> - - <% if gatherer == captain and gatherer.team == gatherer.gather.turn %> - - <% end %> - + <% else %> + <%= flag(gatherer.user.country) if gatherer.user && gatherer.user.country %> + + <% if gatherer == captain and gatherer.team == gatherer.gather.turn %> + <%= icon 'chevron-right' %> + <% end %> + + <%= namelink gatherer.user %> + + <% if gatherer == captain %> + + <%= icon('star') %> + + <% end %> <% end %> - <% if pick %> - >> Pick - <% end %> -
      <%= radio_button_tag :player, gatherer.id %><%= flag gatherer.user.country %><%= namelink gatherer.user %><%= flag(gatherer.user.country) if gatherer.user && gatherer.user.country %>» - <% else %> - - <% end %> - <%= namelink gatherer.user %><%= " (C)" if gatherer == captain %>
      + <% end %> + <% if pick %> + Pick + <% end %> + +<% end %> diff --git a/app/views/gathers/_picking.html.erb b/app/views/gathers/_picking.html.erb index fcf5e23..071a812 100644 --- a/app/views/gathers/_picking.html.erb +++ b/app/views/gathers/_picking.html.erb @@ -1,16 +1,16 @@ -
      - <%= render :partial => "gatherers/list", :locals => {:team => nil} %> +
      + <%= render partial: "gatherers/list", locals: { team: nil } %>
      -
      - <%= render :partial => "gatherers/list", :locals => {:team => 1} %> +
      + <%= render partial: "gatherers/list", locals: { team: 1 } %>
      -
      - <%= render :partial => "gatherers/list", :locals => {:team => 2} %> +
      + <%= render partial: "gatherers/list", locals: { team: 2 } %>
      -<%= render :partial => "status" %> +<%= render partial: "status" %> <% if @gatherer and @gatherer.user_id = 176 %>
      diff --git a/app/views/gathers/_running.html.erb b/app/views/gathers/_running.html.erb index 356c88d..bd998d8 100644 --- a/app/views/gathers/_running.html.erb +++ b/app/views/gathers/_running.html.erb @@ -1,24 +1,21 @@ -
      -

      - Signed Up -

      +
      +

      Signed Up

      - +
        <% @gather.gatherers.each do |gatherer| %> -
      - - - - <%# if gatherer.can_destroy? cuser %> +
    • + <%= flag gatherer.user.country %> + <%= namelink gatherer.user %> <% if cuser and cuser.admin? %> -
    • + <%= link_to gatherer, method: :delete, class: 'delete' do %> + <%= icon 'times' %> + <% end %> <% end %> - <% end %> + + <% end %> + + -
      <%= flag gatherer.user.country %><%= namelink gatherer.user %>[<%= link_to "X", gatherer, :method => :delete %>]
      -
      - - <%= render :partial => "votes" %> - - <%= render :partial => "status" %> +<%= render partial: 'votes' %> +<%= render partial: 'status' %> diff --git a/app/views/gathers/_status.html.erb b/app/views/gathers/_status.html.erb index 8ff8022..ac38146 100644 --- a/app/views/gathers/_status.html.erb +++ b/app/views/gathers/_status.html.erb @@ -1,43 +1,52 @@ -
      +
      <% if @gather.status == Gather::STATE_RUNNING %> + <% if @gatherer and @gatherer.can_destroy? cuser %> - Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed. - <%= link_to 'Leave Gather', @gatherer, :confirm => 'Are you sure?', :method => :delete %> - <% elsif (g = Gatherer.new(:gather => @gather, :user => cuser)).can_create?(cuser) %> +

      Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.

      + <%= link_to 'Leave Gather', @gatherer, confirm: 'Are you sure?', method: :delete, class: 'button tiny' %> + + <% elsif (g = Gatherer.new(gather: @gather, user: cuser)).can_create?(cuser) %> <%= form_for g do |f| %> <%= f.hidden_field :gather_id %> <%= f.hidden_field :user_id %> -

      - Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed. -

      + +

      Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.

      You can download custom maps via the <%= link_to "Steam Workshop", "http://steamcommunity.com/workshop/browse?searchtext=&childpublishedfileid=0§ion=items&appid=4920&browsesort=trend&requiredtags%5B%5D=level" %>.

      +

      <% if cuser.gatherers.count < 5 %> <%= f.check_box :confirm %> I have read the <%= link_to "rules", article_url(Article::G_RULES) %>, installed NS and Teamspeak3. <% end %> - + Click to join gather!

      <% end %> + <% else %> - Log in to join the gather. +

      Log in to join the gather.p

      + <% end %> + <% elsif @gather.status == Gather::STATE_VOTING %> - Please vote captains and maps. +

      Please vote captains and maps.

      + <% elsif @gather.status == Gather::STATE_PICKING %> - <% if @gatherer and @gatherer.captain? %> - <% if @gatherer.turn? %> - It is your turn, please pick a player from the lobby! - <% else%> - Wait for the other captain to pick. +

      + <% if @gatherer and @gatherer.captain? %> + <% if @gatherer.turn? %> + It is your turn, please pick a player from the lobby! + <% else%> + Wait for the other captain to pick. + <% end %> + <% else %> + Captains are picking the teams, please wait. Are you a panda?
      <% end %> - <% else %> - Captains are picking the teams, please wait. Are you a panda ?
      - <% end %> +

      + <% elsif @gather.status == Gather::STATE_FINISHED and @gather.server %> Gather finished, join the <% if @gather.server and @gather.server.ip and @gather.server.password %> @@ -45,19 +54,16 @@ <% else %> Server <% end %> - and TS3.
      - Maps: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %>
      + and TS3.
      + + Maps: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %>
      Server: <% if @gather.server %> <%= @gather.server %> - (<%= @gather.server.ip %>:<%= @gather.server.port %> ; password = <%= if @gather.server.password then @gather.server.password else "" end%>) + (<%= @gather.server.ip %>:<%= @gather.server.port %> ; password = <%= if @gather.server.password then @gather.server.password else "" end %>) <% end %> - <% end %> + <% if cuser and cuser.admin? %> -

      - <%= link_to "Admin Page", edit_gather_url() %> -

      + <%= link_to "Admin Page", edit_gather_url, class: 'admin button' %> <% end %>
      - -
      diff --git a/app/views/gathers/_votes.html.erb b/app/views/gathers/_votes.html.erb index b6aaad9..ef6b347 100644 --- a/app/views/gathers/_votes.html.erb +++ b/app/views/gathers/_votes.html.erb @@ -1,68 +1,53 @@ <% vote_maps, vote_servers = false %> -
      -

      - Server voting -

      +
      +

      Server Votes

      - +
        <% @gather.gather_servers.ordered.each do |server| %> -
      - - - - <% end %> -
      - <%= if server.votes then server.votes else "0" end%> - - <% if server.real_votes.build(:user => cuser).can_create? cuser %> - <%= link_to shorten(server, 15), - :controller => "votes", :action => "create", - :vote => {:votable_id => server.id, :votable_type => "GatherServer"}, - :method => "post" %> - <% vote_servers = true else %> - <%= shorten server, 15 %> - <% end %> -
      +
    • + + <%= if server.votes then server.votes else "0" end %> + + <% if server.real_votes.build(user: cuser).can_create? cuser %> + <%= link_to server, + controller: "votes", action: "create", + vote: { votable_id: server.id, votable_type: "GatherServer" }, + method: "post" %> + <% vote_servers = true else %> + <%= server %> + <% end %> +
    • + <% end %> +
    - <% if vote_servers %> -

    - Click to vote. -

    -

    - <%= link_to "Moar servers", :controller => :servers %> -

    - <% end %> -
    + <% if vote_servers %> +

    Click to vote

    +

    <%= link_to "More servers", { controller: :servers }, { class: 'button tiny' } %>

    + <% end %> +

    -
    -

    - Vote Maps -

    +
    +

    Map Votes

    - - <% @gather.gather_maps.ordered.each do |map| %> - - - - - <% end %> -
    - <%= map.votes %> - - <% if map.real_votes.build(:user => cuser).can_create? cuser %> - <%= link_to shorten(map, 15), - :controller => "votes", :action => "create", - :vote => {:votable_id => map.id, :votable_type => "GatherMap"}, - :method => "post" %> - <% vote_maps = true else %> - <%= shorten map, 15 %> - <% end %> -
    +
      + <% @gather.gather_maps.ordered.each do |map| %> +
    • + <%= map.votes %> + <% if map.real_votes.build(user: cuser).can_create? cuser %> + <%= link_to shorten(map, 15), + controller: "votes", action: "create", + vote: { votable_id: map.id, votable_type: "GatherMap" }, + method: "post" %> + <% vote_maps = true %> + <% else %> + <%= shorten map, 15 %> + <% end %> +
    • + <% end %> +
    - <% if vote_maps %> -

    - Click to vote. -

    - <% end %> -
    + <% if vote_maps %> +

    Click to vote

    + <% end %> +
    diff --git a/app/views/gathers/_voting.html.erb b/app/views/gathers/_voting.html.erb index 328381b..8071d23 100644 --- a/app/views/gathers/_voting.html.erb +++ b/app/views/gathers/_voting.html.erb @@ -1,36 +1,29 @@ -<% if @gatherer and cuser %> - -<% end %> +
    +

    Vote Captains

    -
    -

    - Vote Captains -

    - - +
    <% @gather.gatherers.most_voted.each do |gatherer| %> - + - + controller: "votes", action: "create", + vote: { votable_id: gatherer.id, votable_type: "Gatherer"}, + method: "post" %> <% else %> - <%= namelink gatherer.user %> - <% end %> + <%= namelink gatherer.user %> + <% end %> + <% end %>
    <%= flag gatherer.user.country %>(<%= gatherer.votes %>) - <% if @gatherer and gatherer.real_votes.build(:user => cuser).can_create? cuser %> + + (<%= gatherer.votes %>) + <% if @gatherer and gatherer.real_votes.build(user: cuser).can_create? cuser %> <%= link_to (h gatherer.user), - :controller => "votes", :action => "create", - :vote => {:votable_id => gatherer.id, :votable_type => "Gatherer"}, - :method => "post" %>
    <% if @gatherer %> -

    - Click to vote for captain. -

    +

    Click to vote for captain.

    <% end %>
    -<%= render :partial => "votes" %> - -<%= render :partial => "status" %> +<%= render partial: 'votes' %> +<%= render partial: 'status' %> diff --git a/app/views/gathers/show.html.erb b/app/views/gathers/show.html.erb index cf3ec61..6fc716e 100644 --- a/app/views/gathers/show.html.erb +++ b/app/views/gathers/show.html.erb @@ -1,3 +1,4 @@ +
    -
    +
    +

    + + <%= link_to @gather do %> + <%= @gather.category.to_s %> Gather + <% end %> + +

    -
    -

    -
    - <%= link_to raw("«« First"), @gather.first %> - <%= link_to raw("Previous ‹‹"), @gather.previous_gather %> -
    - <%= link_to @gather do %> - <%= @gather.category.to_s %> Gather +

    + <% end %> +
    <% if @gather and @gather.status != Gather::STATE_FINISHED %> -
    -

    +
    +
    +
    Requirements
    +
      +
    • JavaScript enabled
    • +
    • Read the <%= link_to "Gather Rules", article_url(Article::G_RULES) %>
    • +
    • Remove yourself if you leave
    • +
    +
    -

    +
    +
    Captains
    +
      +
    • Vote for the best players
    • +
    • Captain 1 = 2nd most voted
    • +
    • Captain 2 = 1st most voted
    • +
    +
    - - - +
    +
    Voice Comunication
    +
      +
    • <%= link_to "Teamspeak 3", "http://www.teamspeak.com/?page=downloads" %>
    • +
    • Server: ensl.org
    • +
    • Password: ns2nsl
    • +
    +
    - - - - -
    - Requirements
    - - Javascript needs to enabled
    - - Read <%= link_to "gather rules", article_url(Article::G_RULES) %>
    - - Remove yourself if you leave -
    - Captains:
    - - Vote for the best players
    - - Captain 1 = 2nd most voted
    - - Captain 2 = 1st most voted
    -
    - Voice Comunication:
    - - <%= link_to "Teamspeak 3", "http://www.teamspeak.com/?page=downloads" %>
    - - Server: ensl.org
    - - Password: ns2nsl -
    - - <% end %> -
    +
    <%= render_gather %>
    - <%= render :partial => "shoutmsgs/index", :locals => {:object => @gather} %> + <%= render partial: 'shoutmsgs/index', locals: { object: @gather } %>
    diff --git a/app/views/gathers/show.js.erb b/app/views/gathers/show.js.erb index ad948a9..45bbce8 100644 --- a/app/views/gathers/show.js.erb +++ b/app/views/gathers/show.js.erb @@ -1,2 +1,2 @@ -$("div#gatherArea").children().hide(); -$("div#gatherArea").html("<%= escape_javascript(render_gather) %>"); \ No newline at end of file +$("div#gather-area").children().hide(); +$("div#gather-area").html("<%= escape_javascript(render_gather) %>"); \ No newline at end of file diff --git a/app/views/layouts/full.html.erb b/app/views/layouts/full.html.erb new file mode 100644 index 0000000..8158ead --- /dev/null +++ b/app/views/layouts/full.html.erb @@ -0,0 +1,27 @@ + + + + ENSL + + + + + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tag %> + + +
    + <%= render partial: "header" %> +
    + <%= render partial: "navigation" %> +
    + <%= render partial: "messages" %> + <%= yield %> + <%= render partial: "gather" %> +
    +
    + <%= render partial: "footer" %> +
    + + diff --git a/app/views/shoutmsgs/_index.html.erb b/app/views/shoutmsgs/_index.html.erb index 7a15e15..ef9b41d 100644 --- a/app/views/shoutmsgs/_index.html.erb +++ b/app/views/shoutmsgs/_index.html.erb @@ -9,10 +9,10 @@ }); -<% shoutmsg_new = Shoutmsg.new(:shoutable_type => object.class.to_s, :shoutable_id => object.id) %> +<% shoutmsg_new = Shoutmsg.new(shoutable_type: object.class.to_s, shoutable_id: object.id) %> -
    - <%= render :partial => "shoutmsgs/shoutmsg", :collection => object.shoutmsgs.recent.reverse, :locals => {:popup => "this"} %> +
    + <%= render partial: "shoutmsgs/shoutmsg", collection: object.shoutmsgs.recent.reverse, locals: { popup: 'this' } %>
    -<%= render :partial => "shoutmsgs/new", :locals => {:shoutmsg => shoutmsg_new, :popup => "this"} %> +<%= render partial: "shoutmsgs/new", locals: { shoutmsg: shoutmsg_new, popup: "this" } %> diff --git a/app/views/shoutmsgs/_new.html.erb b/app/views/shoutmsgs/_new.html.erb index af89121..25907da 100644 --- a/app/views/shoutmsgs/_new.html.erb +++ b/app/views/shoutmsgs/_new.html.erb @@ -3,7 +3,7 @@ You have been muted. <% else %> <% scroll = shoutmsg.domain == "shoutbox" ? "" : "$('#{shoutmsg.domain}').scrollTop = $('#{shoutmsg.domain}').scrollHeight;" %> - <%= form_for(shoutmsg, remote: true, html: { id: "new_#{shoutmsg.domain}" }) do |f| %> + <%= form_for(shoutmsg, remote: true, html: { id: "new_#{shoutmsg.domain}", class: 'new-shout' }) do |f| %> <% if shoutmsg.shoutable %> <%= f.hidden_field :shoutable_type %> <%= f.hidden_field :shoutable_id %> diff --git a/app/views/shoutmsgs/_shoutmsg.html.erb b/app/views/shoutmsgs/_shoutmsg.html.erb index 89ea878..403a89b 100644 --- a/app/views/shoutmsgs/_shoutmsg.html.erb +++ b/app/views/shoutmsgs/_shoutmsg.html.erb @@ -1,10 +1,12 @@
    <% if shoutmsg.can_destroy? cuser %> - <%= link_to icon('times'), shoutmsg, :method => :delete %> + <%= link_to icon('times'), shoutmsg, method: :delete %> <% end %> - <%# if shoutmsg.domain != "shoutbox" %> - [<%= shoutmsg.created_at ? shoutmsg.created_at.strftime("%H:%M") : Time.now.strftime("%H:%M") %>] - <%# end %> + + + <%= shoutmsg.created_at ? shoutmsg.created_at.strftime("%H:%M") : Time.now.strftime("%H:%M") %> + + <%= namelink shoutmsg.user %>: <%= shoutmsg.text %>
    diff --git a/app/views/teams/index.html.erb b/app/views/teams/index.html.erb index 3ca5627..29ad380 100644 --- a/app/views/teams/index.html.erb +++ b/app/views/teams/index.html.erb @@ -4,7 +4,3 @@
    <%= render partial: 'list', locals: { teams: @teams } %>
    - - diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb index 42bd0bc..bdd4786 100644 --- a/app/views/teams/show.html.erb +++ b/app/views/teams/show.html.erb @@ -20,21 +20,21 @@
    -
    Irc:
    -
    <%= h @team.irc %>
    +
    IRC:
    +
    <%=h @team.irc %>
    Web:
    -
    <%= h @team.web %>
    +
    <%=h @team.web %>
    Tag:
    -
    <%= h @team.tag %>
    +
    <%=h @team.tag %>
    Country:
    -
    <%= h @team.country %>
    +
    <%=h @team.country %>
    Founder:
    <%= namelink @team.founder %>
    Comment:
    -
    <%= h @team.comment %>
    +
    <%=h @team.comment %>
    <% if @team.recruiting %>
    Recruiting:
    -
    <%= h @team.recruiting %>
    +
    <%=h @team.recruiting %>
    <% end %>
    @@ -45,8 +45,10 @@

    Current Members

    <%= render partial: "teamers/list", locals: { teamers: @team.teamers.active.ordered.distinct, blacklist: false, comment: true } %> -

    Past Members

    - <%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %> + <% if @team.teamers.past.distinct.length > 0 %> +

    Past Members

    + <%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %> + <% end %>
    @@ -62,7 +64,7 @@
    Matches:
    -
    <%= @team.matches_finished.count %> dllayed / <%= @team.matches.count %> total
    +
    <%= @team.matches_finished.count %> played / <%= @team.matches.count %> total
    Won:
    <%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %)
    Lost:
    diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 55bb571..3ebc493 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -1,286 +1,165 @@ -

    Profile: <%= h @user.username %>

    +

    Account: <%= h @user.username %>

    -<%= form_for @user, :html => { :multipart => true } do |f| %> +<%= form_for @user, html: { multipart: true, id: 'profile', class: 'square' } do |f| %> <% f.fields_for :profile do |p| %>
    -
    +
    <% if @user.errors.any? %> -
    -

    - <%= pluralize(@user.errors.count, t(:error)) %> -

    -
      +
      + <%= pluralize(@user.errors.count, t(:error)) %> +
        <% @user.errors.full_messages.each do |msg| %>
      • <%= msg %>
      • <% end %>
      <% end %> -

      - <%= f.label :username, 'Username', :class => 'required' %>
      +

      + <%= f.label :username, 'Username', class: 'required' %> <%= f.text_field :username %> -

      -

      - <%= f.label :raw_password, "Password" %>
      +

      +
      + <%= f.label :raw_password, "Password" %> <%= f.password_field :raw_password %> -

      -

      - <%= f.label :firstname %> (only available to members)
      - <%= f.text_field :firstname %> -

      -

      - <%= f.label :lastname %> (only available to members)
      - <%= f.text_field :lastname %> -

      -

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

      -

      - <%= f.label :birthdate %>
      - <%= date_select :user, :birthdate, :order => [:year, :month, :day], :default => @user.birthdate, :start_year => 1950 %> -

      -
      - -
      -

      - <%= f.label :email %> (only available to admins)
      +

      +
      + <%= f.label :email do %> +

      Email

      + (only visible to admins) + <% end %> <%= f.text_field :email %> -

      -

      - <%= f.label :public_email %>
      +

      +
      + <%= f.label :public_email %> <%= f.check_box :public_email %> -

      -

      - <%= p.label :steam_profile, "Link to your Steam Profile" %>
      +

      +
      + <%= f.label :steamid %> + <%= f.text_field :steamid, html: { placeholder: 'http://steamcommunity.com/id/...' } %> +
      +
      + <%= f.label :firstname do %> +

      First Name

      + (only visible to members) + <% end %> + <%= f.text_field :firstname %> +
      +
      + <%= f.label :lastname do %> +

      Last Name

      + (only visible to members) + <% end %> + <%= f.text_field :lastname %> +
      +
      + <%= f.label :birthdate %> +
      + <%= date_select :user, :birthdate, order: [:year, :month, :day], default: @user.birthdate, start_year: 1950 %> +
      +
      +
    + +
    +
    + <%= p.label :steam_profile, "Steam Profile URL" %> <%= p.text_field :steam_profile %> -

    -

    - <%= p.label :irc %>
    - <%= p.text_field :irc %> -

    -

    - <%= p.label :msn %>
    - <%= p.text_field :msn %> -

    -

    - <%= p.label :icq %>
    - <%= p.text_field :icq %> -

    -

    - <%= p.label :web %>
    +

    +
    + <%= p.label :web %> <%= p.text_field :web %> -

    -
    +
    +
    + <%= p.label :achievements %> + <%= p.text_area :achievements, rows: 5 %> +
    -
    -

    - <%= f.label :country %>
    - <%= country_code_select :user, :country %> -

    -

    - <%= p.label :town %>
    - <%= p.text_field :town %> -

    -

    - <%= f.label :time_zone %>
    - <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.all %> -
    - Daylight savings will be observed automatically. -

    -
    +
    + <%= p.label :signature %> + <%= p.text_area :signature, rows: 5 %> +
    -
    -

    - <%= p.label :singleplayer %>
    - <%= p.text_field :singleplayer %> -

    -

    - <%= p.label :multiplayer %>
    - <%= p.text_field :multiplayer %> -

    -

    - <%= p.label :food %>
    - <%= p.text_field :food %> -

    -

    - <%= p.label :beverage %>
    - <%= p.text_field :beverage %> -

    -

    - <%= p.label :hobby %>
    - <%= p.text_field :hobby %> -

    -

    - <%= p.label :music %>
    - <%= p.text_field :music %> -

    -

    - <%= p.label :book %>
    - <%= p.text_field :book %> -

    -

    - <%= p.label :movie %>
    - <%= p.text_field :movie %> -

    -

    - <%= p.label :tvseries %>
    - <%= p.text_field :tvseries %> -

    -
    - -
    -

    - <%= p.label :res %>
    - <%= p.text_field :res %> -

    -

    - <%= p.label :sensitivity %>
    - <%= p.text_field :sensitivity %> -

    -

    - <%= p.label :monitor_hz %>
    - <%= p.text_field :monitor_hz %> -

    -

    - <%= p.label :scripts %>
    - <%= p.text_field :scripts %> -

    -
    - -
    -

    - <%= p.label :cpu %>
    - <%= p.text_field :cpu %> -

    -

    - <%= p.label :gpu %>
    - <%= p.text_field :gpu %> -

    -

    - <%= p.label :ram %>
    - <%= p.text_field :ram %> -

    -

    - <%= p.label :psu %>
    - <%= p.text_field :psu %> -

    -

    - <%= p.label :motherboard %>
    - <%= p.text_field :motherboard %> -

    -

    - <%= p.label :soundcard %>
    - <%= p.text_field :soundcard %> -

    -

    - <%= p.label :hdd %>
    - <%= p.text_field :hdd %> -

    -

    - <%= p.label :case %>
    - <%= p.text_field :case %> -

    -

    - <%= p.label :monitor %>
    - <%= p.text_field :monitor %> -

    -

    - <%= p.label :mouse %>
    - <%= p.text_field :mouse %> -

    -

    - <%= p.label :mouse_pad %>
    - <%= p.text_field :mouse_pad %> -

    -

    - <%= p.label :keyboard %>
    - <%= p.text_field :keyboard %> -

    -

    - <%= p.label :head_phones %>
    - <%= p.text_field :head_phones %> -

    -

    - <%= p.label :speakers %>
    - <%= p.text_field :speakers %> -

    -
    - -
    -

    - <%= p.label :achievements %>
    - <%= p.text_area :achievements %> -

    - -

    - <%= p.label :signature %>
    - <%= p.text_area :signature, :rows => 5, :cols => 50 %> -

    - -

    -
    +

    + <%= p.file_field :avatar %> -

    +
    +
    + +
    +
    + <%= f.label :country %> +
    + <%= country_code_select :user, :country %> +
    +
    +
    + <%= p.label :town %> + <%= p.text_field :town %> +
    +
    + <%= f.label :time_zone %> +
    + <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.all %> +

    Daylight savings will be observed automatically.

    +
    +
    -

    - <%= p.label :notify_news, "Notify me when news are posted" %>
    +

    Notify me when...

    + +
    + <%= p.label :notify_news, "News item are posted" %> <%= p.check_box :notify_news %> -

    +
    -

    - <%= p.label :notify_articles, "Notify me of new articles" %>
    +

    + <%= p.label :notify_articles, "New articles" %> <%= p.check_box :notify_articles %> -

    +
    -

    - <%= p.label :notify_movies, "Notify me of new movies" %>
    +

    + <%= p.label :notify_movies, "New movies" %> <%= p.check_box :notify_movies %> -

    +
    -

    - <%= p.label :notify_gather, "Notify me when gather has 6 players" %>
    +

    + <%= p.label :notify_gather, "Gather has 6 players" %> <%= p.check_box :notify_gather %> -

    +
    -

    - <%= p.label :notify_own_match, "Notify me of my team's matches" %>
    +

    + <%= p.label :notify_own_match, "My team's matches" %> <%= p.check_box :notify_own_match %> -

    +
    -

    - <%= p.label :notify_any_match, "Notify me of any new match" %>
    +

    + <%= p.label :notify_any_match, "New matches" %> <%= p.check_box :notify_any_match %> -

    +
    -

    - <%= p.label :notify_challenge, "Notify me of new challenges" %>
    +

    + <%= p.label :notify_challenge, "New challenges" %> <%= p.check_box :notify_challenge %> -

    +
    -

    - <%= p.label :notify_pms, "Notify me of private messages" %>
    +

    + <%= p.label :notify_pms, "Private messages" %> <%= p.check_box :notify_pms %> -

    +
    -

    + +

    <%= f.submit %> -

    +
    <% end %> <% end %> diff --git a/app/views/widgets/_logged.html.erb b/app/views/widgets/_logged.html.erb index 196f17d..7e33b10 100644 --- a/app/views/widgets/_logged.html.erb +++ b/app/views/widgets/_logged.html.erb @@ -3,7 +3,7 @@
    • <%= link_to edit_user_path(cuser) do %> - <%= icon 'user' %> Profile + <%= icon 'user' %> Account <% end %>
    • diff --git a/app/views/widgets/_shoutbox.html.erb b/app/views/widgets/_shoutbox.html.erb index 23525c1..ba3fe75 100644 --- a/app/views/widgets/_shoutbox.html.erb +++ b/app/views/widgets/_shoutbox.html.erb @@ -1,7 +1,7 @@

      <%= t('widget.shoutbox') %>

      -
      +
      <%= render :partial => "shoutmsgs/shoutmsg", :collection => Shoutmsg.recent.box, :locals => {:popup => "$('shoutbox')"} %>
      diff --git a/config/deploy.rb b/config/deploy.rb index 893cff3..a16c425 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -12,7 +12,8 @@ set :rbenv_type, :user set :rbenv_ruby, '2.1.1' set :dotenv_role, [:app, :web] -set :unicorn_config_path, "config/unicorn.rb" +set :puma_config, -> { File.join(shared_path, 'puma.rb') } +set :puma_pid, -> { File.join(shared_path, 'tmp', 'pids', 'puma.pid') } set :writable_dirs, %w{public tmp} set :linked_files, %w{.env} @@ -42,8 +43,49 @@ namespace :deploy do end task :restart do - invoke 'unicorn:restart' + invoke 'puma:restart' end after :publishing, :restart +end + +namespace :puma do + desc "Start puma" + task :start do + on roles(:app) do + within current_path do + execute :bundle, 'exec', :puma, "-C #{fetch(:puma_config)}" + end + end + end + + desc "Restart puma" + task :restart do + on roles(:app) do + within current_path do + if valid_pid? + execute :kill, "-USR2 $( cat #{fetch(:puma_pid)} )" + else + execute :bundle, 'exec', :puma, "-C #{fetch(:puma_config)}" + end + end + end + end + + desc "Stop puma" + task :stop do + on roles(:app) do + within current_path do + if valid_pid? + execute :kill, "-INT $( cat #{fetch(:puma_pid)} )" + else + warn 'Puma does not appear to be running' + end + end + end + end + + def valid_pid? + test "[ -f #{fetch(:puma_pid)} ]" and test "kill -0 $( cat #{fetch(:puma_pid)} )" + end end \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index 6a8fbf4..16d3963 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -32,5 +32,5 @@ Ensl::Application.configure do config.cache_store = :dalli_store # Enable threaded mode - config.threadsafe! + # config.threadsafe! end diff --git a/config/environments/test.rb b/config/environments/test.rb index d099083..72ed1b6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -32,7 +32,4 @@ Ensl::Application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr - - # Enable threaded mode - config.threadsafe! end diff --git a/config/locales/en.yml b/config/locales/en.yml index 7ab7f3d..19d054c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -18,6 +18,7 @@ en: contests_update: "Contest was successfully updated." contests_join: "Team successfully joined contest." contests_contester_update: "Contester was successfully updated." + gather_create: "New Gather was started successfully." gathers_join: "You have joined the Gather." files_create: "File was successfully created." files_update: "File was successfully updated." diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..e22acfa --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,39 @@ +require "dotenv" +Dotenv.load + +base_path = (ENV['DEPLOY_PATH'] || Dir.pwd) +current_path = "#{base_path}" +shared_path = "#{base_path}" +stderr_path = "#{shared_path}/log/puma.stderr.log" +stdout_path = "#{shared_path}/log/puma.stdout.log" + +tag 'ENSL' + +preload_app! +daemonize true +directory base_path +pidfile "#{shared_path}/tmp/pids/puma.pid" +state_path "#{shared_path}/tmp/pids/puma.state" +stdout_redirect stdout_path, stderr_path + +environment ENV['RACK_ENV'] || 'production' +rackup DefaultRackup + +bind "unix://#{shared_path}#{ENV['PUMA_SOCKET']}" +port Integer(ENV['PUMA_PORT'] || 4000) + +worker_timeout Integer(ENV['PUMA_TIMEOUT'] || 30) +workers Integer(ENV['PUMA_WORKERS'] || 4) +threads Integer(ENV['PUMA_MIN_THREADS'] || 1), Integer(ENV['PUMA_MAX_THREADS'] || 16) + +on_worker_boot do + ActiveSupport.on_load(:active_record) do + ActiveRecord::Base.establish_connection + end +end + +on_restart do + ENV["BUNDLE_GEMFILE"] = "#{current_path}/Gemfile" + Dotenv.overload + ActiveRecord::Base.connection.disconnect! +end diff --git a/config/unicorn.rb b/config/unicorn.rb deleted file mode 100644 index 75793d3..0000000 --- a/config/unicorn.rb +++ /dev/null @@ -1,43 +0,0 @@ -require "dotenv" -Dotenv.load - -base_path = (ENV['DEPLOY_PATH'] || Dir.pwd) -current_path = "#{base_path}/current" -shared_path = "#{base_path}/shared" - -working_directory current_path -worker_processes Integer(ENV['UNICORN_WORKERS'] || 4) -timeout 30 -preload_app true - -user ENV['UNICORN_USER'], ENV['UNICORN_GROUP'] -listen Integer(ENV['UNICORN_PORT']), :tcp_nopush => true -listen ENV['UNICORN_SOCKET'], :backlog => 64 - -stderr_path "#{shared_path}/log/unicorn.stderr.log" -stdout_path "#{shared_path}/log/unicorn.stdout.log" -pid "#{shared_path}/tmp/pids/unicorn.pid" - -GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true - -before_exec do |server| - ENV["BUNDLE_GEMFILE"] = "#{current_path}/Gemfile" - Dotenv.overload -end - -before_fork do |server, worker| - ActiveRecord::Base.connection.disconnect! - - old_pid = "#{server.config[:pid]}.oldbin" - if old_pid != server.pid - begin - sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU - Process.kill(sig, File.read(old_pid).to_i) - rescue Errno::ENOENT, Errno::ESRCH - end - end -end - -after_fork do |server, worker| - ActiveRecord::Base.establish_connection -end \ No newline at end of file diff --git a/script/rails b/script/rails index 81eab02..75bd144 100644 --- a/script/rails +++ b/script/rails @@ -1,5 +1,7 @@ -#!/usr/bin/env ruby.exe -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. +#!/usr/bin/env ruby + +require 'rack/handler' +Rack::Handler::WEBrick = Rack::Handler.get(:puma) APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__)