Switched web server to puma

Added styling to gathers page
Added styling to account page
Improved forms styling
This commit is contained in:
Luke Barratt 2014-04-15 10:59:52 +01:00
parent 0112ef9005
commit 37e768c68f
51 changed files with 909 additions and 653 deletions

View file

@ -4,11 +4,12 @@ APP_SECRET=
DEPLOY_PATH= DEPLOY_PATH=
UNICORN_USER=deploy PUMA_WORKERS=1
UNICORN_GROUP=deploy PUMA_MIN_THREADS=1
UNICORN_WORKERS=4 PUMA_MAX_THREADS=16
UNICORN_PORT=4000 PUMA_PORT=4000
UNICORN_SOCKET=/tmp/unicorn.ensl.sock PUMA_SOCKET=/tmp/ensl.sock
PUMA_TIMEOUT=30
MYSQL_DATABASE=ensl MYSQL_DATABASE=ensl
MYSQL_USERNAME= MYSQL_USERNAME=

View file

@ -3,6 +3,5 @@ require 'capistrano/deploy'
require 'capistrano/rbenv' require 'capistrano/rbenv'
require 'capistrano/bundler' require 'capistrano/bundler'
require 'capistrano/rails' require 'capistrano/rails'
require 'capistrano3/unicorn'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

View file

@ -6,6 +6,7 @@ gem 'dotenv-rails', '~> 0.10.0'
gem 'rails', '~> 3.2.17' gem 'rails', '~> 3.2.17'
gem 'mysql2', '~> 0.3.15' gem 'mysql2', '~> 0.3.15'
gem 'dalli', '~> 2.7.0' gem 'dalli', '~> 2.7.0'
gem 'puma', '~> 2.8.2'
gem 'exceptional', '~> 2.0.33' gem 'exceptional', '~> 2.0.33'
gem 'oj', '~> 2.5.5' gem 'oj', '~> 2.5.5'
@ -34,7 +35,6 @@ gem 'sass-rails', '~> 3.2.6'
gem 'font-awesome-sass', '~> 4.0.3.1' gem 'font-awesome-sass', '~> 4.0.3.1'
gem 'bourbon', '~> 3.1.8' gem 'bourbon', '~> 3.1.8'
gem 'neat', '~> 1.6.0' gem 'neat', '~> 1.6.0'
gem 'bitters', '~> 0.9.3'
group :assets do group :assets do
gem 'uglifier', '~> 2.5.0' gem 'uglifier', '~> 2.5.0'
@ -45,7 +45,6 @@ group :development do
gem 'capistrano-rbenv', '~> 2.0.2' gem 'capistrano-rbenv', '~> 2.0.2'
gem 'capistrano-bundler', '~> 1.1.2' gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1' gem 'capistrano-rails', '~> 1.1'
gem 'capistrano3-unicorn', '~> 0.1.1'
gem 'better_errors', '~> 1.1.0' gem 'better_errors', '~> 1.1.0'
gem 'binding_of_caller', '~> 0.7.2' gem 'binding_of_caller', '~> 0.7.2'
gem 'annotate', '~> 2.6.2' gem 'annotate', '~> 2.6.2'
@ -67,8 +66,3 @@ end
group :development, :test do group :development, :test do
gem 'pry-debugger', '~> 0.2.2' gem 'pry-debugger', '~> 0.2.2'
end end
group :staging, :production do
gem 'kgio', '~> 2.9.2'
gem 'unicorn', '~> 4.8.2'
end

View file

@ -40,10 +40,6 @@ GEM
erubis (>= 2.6.6) erubis (>= 2.6.6)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bitters (0.9.3)
bourbon (>= 3.1)
sass (>= 3.2)
thor
bluecloth (2.2.0) bluecloth (2.2.0)
bourbon (3.1.8) bourbon (3.1.8)
sass (>= 3.2.0) sass (>= 3.2.0)
@ -62,8 +58,6 @@ GEM
capistrano-rbenv (2.0.2) capistrano-rbenv (2.0.2)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.3) sshkit (~> 1.3)
capistrano3-unicorn (0.1.1)
capistrano (>= 3.1.0)
capybara (2.2.1) capybara (2.2.1)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
@ -129,7 +123,6 @@ GEM
railties (>= 3.2.0, < 5.0) railties (>= 3.2.0, < 5.0)
thor (~> 0.14) thor (~> 0.14)
json (1.8.1) json (1.8.1)
kgio (2.9.2)
libv8 (3.16.14.3) libv8 (3.16.14.3)
mail (2.5.4) mail (2.5.4)
mime-types (~> 1.16) mime-types (~> 1.16)
@ -170,6 +163,8 @@ GEM
pry-debugger (0.2.2) pry-debugger (0.2.2)
debugger (~> 1.3) debugger (~> 1.3)
pry (~> 0.9.10) pry (~> 0.9.10)
puma (2.8.2)
rack (>= 1.1, < 2.0)
quiet_assets (1.0.2) quiet_assets (1.0.2)
railties (>= 3.1, < 5.0) railties (>= 3.1, < 5.0)
rack (1.4.5) rack (1.4.5)
@ -194,7 +189,6 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
rdoc (~> 3.4) rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0) thor (>= 0.14.6, < 2.0)
raindrops (0.13.0)
rake (10.1.1) rake (10.1.1)
rdoc (3.12.2) rdoc (3.12.2)
json (~> 1.4) json (~> 1.4)
@ -257,10 +251,6 @@ GEM
uglifier (2.5.0) uglifier (2.5.0)
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
unicorn (4.8.2)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
websocket (1.0.7) websocket (1.0.7)
websocket-driver (0.3.2) websocket-driver (0.3.2)
will_paginate (3.0.5) will_paginate (3.0.5)
@ -278,14 +268,12 @@ DEPENDENCIES
bbcoder (~> 1.0.1) bbcoder (~> 1.0.1)
better_errors (~> 1.1.0) better_errors (~> 1.1.0)
binding_of_caller (~> 0.7.2) binding_of_caller (~> 0.7.2)
bitters (~> 0.9.3)
bluecloth (~> 2.2.0) bluecloth (~> 2.2.0)
bourbon (~> 3.1.8) bourbon (~> 3.1.8)
capistrano (~> 3.1.0) capistrano (~> 3.1.0)
capistrano-bundler (~> 1.1.2) capistrano-bundler (~> 1.1.2)
capistrano-rails (~> 1.1) capistrano-rails (~> 1.1)
capistrano-rbenv (~> 2.0.2) capistrano-rbenv (~> 2.0.2)
capistrano3-unicorn (~> 0.1.1)
capybara (~> 2.2.1) capybara (~> 2.2.1)
carrierwave (~> 0.10.0) carrierwave (~> 0.10.0)
codeclimate-test-reporter (~> 0.3.0) codeclimate-test-reporter (~> 0.3.0)
@ -301,7 +289,6 @@ DEPENDENCIES
font-awesome-sass (~> 4.0.3.1) font-awesome-sass (~> 4.0.3.1)
gruff (~> 0.3.6) gruff (~> 0.3.6)
jquery-rails (~> 2.0.2) jquery-rails (~> 2.0.2)
kgio (~> 2.9.2)
mysql2 (~> 0.3.15) mysql2 (~> 0.3.15)
neat (~> 1.6.0) neat (~> 1.6.0)
newrelic_rpm (~> 3.7.2.195) newrelic_rpm (~> 3.7.2.195)
@ -309,6 +296,7 @@ DEPENDENCIES
oj (~> 2.5.5) oj (~> 2.5.5)
poltergeist (~> 1.5.0) poltergeist (~> 1.5.0)
pry-debugger (~> 0.2.2) pry-debugger (~> 0.2.2)
puma (~> 2.8.2)
quiet_assets (~> 1.0.2) quiet_assets (~> 1.0.2)
rails (~> 3.2.17) rails (~> 3.2.17)
rmagick (~> 2.13.2) rmagick (~> 2.13.2)
@ -323,5 +311,4 @@ DEPENDENCIES
timecop (~> 0.7.1) timecop (~> 0.7.1)
tinymce-rails (~> 3.5.9) tinymce-rails (~> 3.5.9)
uglifier (~> 2.5.0) uglifier (~> 2.5.0)
unicorn (~> 4.8.2)
will_paginate (~> 3.0.5) will_paginate (~> 3.0.5)

View file

@ -9,5 +9,21 @@
//= require_self //= require_self
$ -> $ ->
$("#logout").click -> $('logout').click ->
$(this).closest("form").submit() $(this).closest('form').submit()
$('select').each (i, el) ->
$select = $(el)
$select.wrap '<div class="select-wrapper" />'
$select.on 'DOMSubtreeModified', (event) ->
$el = $(this)
$wrapper = $el.parent()
if $el.is("[disabled]")
$wrapper.addClass 'disabled'
else
$wrapper.removeClass 'disabled'
$select.trigger 'DOMSubtreeModified'

View file

@ -123,8 +123,8 @@ $( function() {
// Gather stuff // Gather stuff
$("a#gatherInfoHide").live('click', function() { $("a#gather-info-hide").live('click', function() {
$("div#gatherInfo").fadeOut('slow', 0); $("div#gather-info").fadeOut('slow', 0);
}); });
$("a#gatherJoinBtn").live('click', function() { $("a#gatherJoinBtn").live('click', function() {

View file

@ -23,8 +23,9 @@ $large-screen-up: new-breakpoint(min-width $large-screen 8);
Typography Typography
*/ */
$open-sans: "Open Sans", sans-serif; $open-sans: 'Open Sans', sans-serif;
$montserrat: "Montserrat", sans-serif; $montserrat: 'Montserrat', sans-serif;
$fontawesome: 'FontAwesome';
$sans-serif: $open-sans; $sans-serif: $open-sans;
$base-font-family: $sans-serif; $base-font-family: $sans-serif;
@ -91,6 +92,7 @@ $flash-success: #1f7f5c;
$flash-warning: $red; $flash-warning: $red;
$flash-error: #e56c69; $flash-error: #e56c69;
$input-font-size: em(16);
$input-primary: white; $input-primary: white;
$input-secondary: #5a9aa8; $input-secondary: #5a9aa8;
$input-text: #232323; $input-text: #232323;

View file

@ -27,6 +27,7 @@
@import "components/breadcrumbs"; @import "components/breadcrumbs";
@import "components/pagination"; @import "components/pagination";
@import "components/tabs"; @import "components/tabs";
@import "components/shoutbox";
/* /*
Layout Layout

View file

@ -6,8 +6,8 @@ form {
.fields { .fields {
> .field_with_errors:first-child, > .field_with_errors:first-child,
> label { > label {
padding: 11px 0; padding: em(11) 0;
line-height: 16px; line-height: em(16);
} }
> .field_with_errors { > .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 { textarea {
background-color: $input-primary; background-color: $input-primary;
color: $input-text; color: $input-text;
font-size: em(16); font-size: $input-font-size;
padding: $input-padding; padding: $input-padding;
height: em(40); height: em(40);
border: $input-border-colour solid $input-border-width; 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 { textarea {
height: auto; height: auto;
width: 100%; width: 100%;
@ -58,7 +150,7 @@ form {
margin-bottom: em(20); margin-bottom: em(20);
button, button,
input { input[type=submit] {
@include button($button-secondary); @include button($button-secondary);
margin-bottom: 0; margin-bottom: 0;
outline: none; outline: none;
@ -127,7 +219,10 @@ form.square {
line-height: em(16); line-height: em(16);
} }
input, .inputs,
input[type=text],
input[type=password],
input[type=email],
textarea { textarea {
@include span-columns(9); @include span-columns(9);
} }

View file

@ -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 Status
*/ */
#gather { #gather-status {
@include span-columns(12); @include span-columns(12);
@include flash; @include flash;

View file

@ -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);
}
}

View file

@ -1,5 +1,5 @@
/* /*
Breadcrumbs Tabs
*/ */
.tabbed { .tabbed {

View file

@ -64,7 +64,7 @@ h1, h2, h3, h4, h5, h6 {
&:before { &:before {
content: ""; content: "";
display: block; display: block;
border-top: 2px solid $blue; border-top: 2px solid $light-gray;
width: 100%; width: 100%;
height: 2px; height: 2px;
position: absolute; position: absolute;

View file

@ -1,3 +1,16 @@
/*
Contester
*/
#matches {
@include span-columns(12);
margin: em(20) 0;
}
/*
Contest List
*/
table.contest { table.contest {
margin-bottom: em(40); margin-bottom: em(40);
@ -50,6 +63,10 @@ table.contest {
} }
} }
/*
Brackets
*/
table.brackets { table.brackets {
margin: em(20) 0 em(40) 0; margin: em(20) 0 em(40) 0;
width: auto; width: auto;

View file

@ -3,6 +3,8 @@
*/ */
#matches { #matches {
width: 100%;
display: table;
table-layout: auto; table-layout: auto;
margin-bottom: em(20); margin-bottom: em(20);

View file

@ -1,3 +1,7 @@
/*
Users Listing
*/
#users { #users {
table-layout: auto; table-layout: auto;
@ -19,3 +23,33 @@
text-align: right; text-align: right;
} }
} }
/*
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;
}
}
}

View file

@ -7,6 +7,7 @@ class GathersController < ApplicationController
end end
def show def show
render layout: 'full'
end end
def latest def latest

View file

@ -155,4 +155,8 @@ module ApplicationHelper
event.start event.start
end end
end end
def latest_rules
Contest.last.rules
end
end end

View file

@ -1,18 +1,21 @@
module GathersHelper module GathersHelper
def render_gather def render_gather
if @gather.status == Gather::STATE_RUNNING if @gather.status == Gather::STATE_RUNNING
headers["Gather"] = "running" headers['Gather'] = 'running'
render :partial => "running", :layout => false
render partial: 'running', layout: false
elsif @gather.status == Gather::STATE_VOTING elsif @gather.status == Gather::STATE_VOTING
if @gatherer and @gather.gatherer_votes.first(:conditions => {:user_id => cuser.id}) if @gatherer and @gather.gatherer_votes.first(conditions: { user_id: cuser.id })
headers["Gather"] = "voted" headers['Gather'] = 'voted'
else else
headers["Gather"] = "voting" headers['Gather'] = 'voting'
end end
render :partial => "voting", :layout => false
render partial: 'voting', layout: false
elsif @gather.status == Gather::STATE_PICKING or @gather.status == Gather::STATE_FINISHED elsif @gather.status == Gather::STATE_PICKING or @gather.status == Gather::STATE_FINISHED
headers["Gather"] = "picking" headers['Gather'] = 'picking'
render :partial => "picking", :layout => false
render partial: 'picking', layout: false
end end
end end
end end

View file

@ -163,7 +163,7 @@ class User < ActiveRecord::Base
end end
def from def from
if profile.town.length > 0 if profile.town && profile.town.length > 0
"#{profile.town}, #{country_s}" "#{profile.town}, #{country_s}"
else else
"#{country_s}" "#{country_s}"

View file

@ -1,4 +1,4 @@
<div id="gather"> <div id="gather-status">
<% if cuser && (gather = cuser.gathers.active.ordered.first) %> <% if cuser && (gather = cuser.gathers.active.ordered.first) %>
<%= link_to t('gather.status.joined'), gather %> <%= link_to t('gather.status.joined'), gather %>
<% elsif Gather.last && (Gather::FULL - Gather.last.gatherers.count) == 12 %> <% elsif Gather.last && (Gather::FULL - Gather.last.gatherers.count) == 12 %>

View file

@ -23,7 +23,7 @@
<ul> <ul>
<li><%= link_to "Staff", controller: "about", action: "staff" %></li> <li><%= link_to "Staff", controller: "about", action: "staff" %></li>
<li><%= link_to "History", article_url(Article::HISTORY) %></li> <li><%= link_to "History", article_url(Article::HISTORY) %></li>
<li><%= link_to "Rules", article_url(Article::RULES) %></li> <li><%= link_to "Rules", latest_rules %></li>
<li><%= link_to "Hall of Fame", article_url(Article::HOF) %></li> <li><%= link_to "Hall of Fame", article_url(Article::HOF) %></li>
<li><%= link_to "Bans", bans_url %></li> <li><%= link_to "Bans", bans_url %></li>
<li><%= link_to "Contact", new_issue_path %></li> <li><%= link_to "Contact", new_issue_path %></li>

View file

@ -1,6 +1,6 @@
<div id="comment_<%= comment.id %>" class="comment"> <div id="comment_<%= comment.id %>" class="comment">
<div class="comment-image"> <div class="comment-image">
<%= image_tag comment.user.profile.avatar.url, id: "user" %> <%= image_tag comment.user.profile.avatar.url %>
</div> </div>
<div class="comment-content"> <div class="comment-content">
<h1> <h1>

View file

@ -1,31 +1,33 @@
<div class="wide" id="matches"> <div id="team-profile">
<h1 class="center"> <h1 class="fancy">
<%= link_to (h @contester.team.name), team_url(@contester.team, :teamTab => "matches", :anchor => "contest_#{@contester.contest.id}") %> <span>
<%= link_to (h @contester.team.name), team_url(@contester.team, team: 'matches', anchor: "contest_#{@contester.contest.id}") %>
</span>
</h1> </h1>
<h4 class="center">
<%= namelink @contester.contest %>
</h4>
<% if @contester.team.logo %> <% if @contester.team.logo %>
<%= image_tag @contester.team.logo.url, :class => "centered" %> <div class="logo">
<%= image_tag @contester.team.logo.url, class: 'logo' %>
</div>
<% end %> <% end %>
</div> </div>
<div class="wide2" id="matchesTab"> <h4 class="nane"><%= namelink @contester.contest %></h4>
<ul id="matchesTab-nav" class="tabs">
<div id="matches" class="tabbed">
<ul id="matches-nav" class="tabs">
<li><a href="#results">Results</a></li> <li><a href="#results">Results</a></li>
<li><a href="#upcoming">Upcoming</a></li> <li><a href="#upcoming">Upcoming</a></li>
<li><a href="#info>">Info</a></li> <li><a href="#info>">Info</a></li>
</ul> </ul>
<div class="box tabs"> <div class="tabbed-contents">
<div class="tab" id="results"> <div class="tab" id="results">
<%= render :partial => "matches/list", :locals => {:matches => @results, :friendly => @contester.team, :contest => false} %> <%= render partial: 'matches/list', locals: { matches: @results, friendly: @contester.team, contest: false } %>
</div> </div>
<div class="tab" id="results"> <div class="tab" id="results">
<h3> <h3>Upcoming</h3>
Upcoming
</h3>
<table class="data"> <table class="data">
<tr> <tr>
@ -48,35 +50,29 @@
</div> </div>
<div class="tab" id="info"> <div class="tab" id="info">
<h3 class="center"> <h3>Rank</h3>
Rank
</h3>
<%= cascade @contester, ["total", "win", "loss", "draw"] %> <%= cascade @contester, ["total", "win", "loss", "draw"] %>
<% if !@contester.active %> <% if !@contester.active %>
<p> <p><strong>INACTIVE</strong></p>
<b>INACTIVE</b>
</p>
<% end %> <% end %>
</div> </div>
</div> </div>
</div> </div>
<div class="box wide clear"> <div class="members">
<h3 class="center"> <h3>Members</h3>
Members <%= render partial: 'teamers/list', locals: { teamers: @members, blacklist: nil, comment: false } %>
</h3>
<%= render :partial => "teamers/list", :locals => {:teamers => @members, :blacklist => nil, :comment => false} %>
</div> </div>
<%= link_to 'Back', @contester.contest, class: 'button' %>
<% if @contester.can_update? cuser %> <% if @contester.can_update? cuser %>
<%= link_to 'Edit', edit_contester_path(@contester) %> | <%= link_to 'Edit', edit_contester_path(@contester), class: 'button' %>
<% end %> <% end %>
<%= link_to 'Back', @contester.contest %>
<script type="text/javascript"> <script type="text/javascript">
var tabber1 = new Yetii({id: 'matchesTab'}); new Yetii({
id: 'matches'
});
</script> </script>

View file

@ -1,7 +1 @@
<div class="nbox big left"> <%= render partial: 'contesters/list', locals: { contesters: @contest.contesters.active.ordered, actions: true } %>
<%= render :partial => "contesters/list", :locals => {:contesters => @contest.contesters.active.ordered, :actions => true} %>
</div>
<script type="text/javascript">
var tabber1 = new Yetii({id: 'contestTab'});
</script>

View file

@ -2,24 +2,23 @@
<div class="contest info"> <div class="contest info">
<h3>Details</h3> <h3>Details</h3>
<p>
<strong>From-to</strong>:<br> <dl>
<%= longdate @contest.start %> <br> <%= longdate @contest.end %> <dt>Start - End</dt>
</p> <dd>
<p> <%= longdate @contest.start %><br>
<strong>Rules</strong>:<br> <%= longdate @contest.end %>
<%= namelink @contest.rules %> </dd>
</p> <dt>Rules</dt>
<p> <dd><%= namelink @contest.rules %></dd>
<b>Status:</b><br> <dt>Status</dt>
<%= @contest.statuses[@contest.status] %> <dd><%= @contest.statuses[@contest.status] %></dd>
</p> <dt>Default</dt>
<p> <dd>Sunday: <%=h @contest.default_time.strftime("%H:%M") %></dd>
<b>Default:</b><br> </dl>
Sunday: <%= h @contest.default_time.strftime("%H:%M") %>
</p>
<% if @contest.contest_type == Contest::TYPE_LADDER %> <% if @contest.contest_type == Contest::TYPE_LADDER %>
<%= link_to "Scoring", "/contests/#{@contest}/score" %> <%= link_to 'Scoring', "/contests/#{@contest}/score" %>
<% end %> <% end %>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<%= link_to 'Edit', edit_contest_path(@contest) %> <%= link_to 'Edit', edit_contest_path(@contest) %>
@ -27,19 +26,19 @@
</div> </div>
<% if @contest.contest_type == Contest::TYPE_BRACKET %> <% if @contest.contest_type == Contest::TYPE_BRACKET %>
<%= render :partial => "bracket", :locals => {:contest => @contest} %> <%= render partial: 'bracket', locals: { contest: @contest } %>
<% else %> <% else %>
<%= render :partial => "normal" %> <%= render partial: 'normal' %>
<% end %> <% end %>
<div id="contestTab" class="clear wide"> <div id="contest" class="tabbed">
<ul id="contestTab-nav" class="tabs"> <ul id="contest-nav" class="tabs">
<li><a href="#results">Matches</a></li> <li><a href="#results">Matches</a></li>
<li><a href="#predictions">Predictions</a></li> <li><a href="#predictions">Predictions</a></li>
<li><a href="#maps">Maps</a></li> <li><a href="#maps">Maps</a></li>
</ul> </ul>
<div class="box wide2 tabs"> <div class="tabbed-contents">
<div class="tab" id="results"> <div class="tab" id="results">
<h3> <h3>
Matches Played Matches Played
@ -172,5 +171,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var tabber1 = new Yetii({id: 'contestTab'}); new Yetii({
id: 'contest'
});
</script> </script>

View file

@ -1,5 +1,5 @@
<h1>New forum</h1> <h1>New Forum</h1>
<%= render :partial => "form" %> <%= render partial: "form" %>
<%= link_to 'Back', forums_path %> <%= link_to 'Back', forums_path, class: 'button' %>

View file

@ -1,32 +1,38 @@
<% captain = team == 1 ? @gather.captain1 : @gather.captain2 %> <% captain = team == 1 ? @gather.captain1 : @gather.captain2 %>
<% pick = false %> <% pick = false %>
<h2 class="center"> <h4>
<%= if team.nil? then "Lobby" else team == 1 ? "Marines" : "Aliens" end %> <%= if team.nil? then "Lobby" else team == 1 ? "Marines" : "Aliens" end %>
</h2> </h4>
<%= form_tag("/gathers/pick/#{@gather.id}") do %> <%= form_tag("/gathers/pick/#{@gather.id}") do %>
<ul class="gatherers">
<table id="gatherersTable">
<% @gather.gatherers.ordered.team(team).each do |gatherer| %> <% @gather.gatherers.ordered.team(team).each do |gatherer| %>
<tr height="10"> <li>
<% if @gatherer and gatherer.can_update? cuser, {:team => @gatherer.team} %> <% if @gatherer and gatherer.can_update? cuser, { team: @gatherer.team } %>
<% pick = true %> <% pick = true %>
<td><%= radio_button_tag :player, gatherer.id %><%= flag gatherer.user.country %></td> <%= radio_button_tag :player, gatherer.id %><%= flag gatherer.user.country %>
<td><%= namelink gatherer.user %></td> <%= namelink gatherer.user %>
<% else %> <% else %>
<td><%= flag(gatherer.user.country) if gatherer.user && gatherer.user.country %></td> <%= flag(gatherer.user.country) if gatherer.user && gatherer.user.country %>
<% if gatherer == captain and gatherer.team == gatherer.gather.turn %> <% if gatherer == captain and gatherer.team == gatherer.gather.turn %>
<td>&#187; <%= icon 'chevron-right' %>
<% else %>
<td>
<% end %> <% end %>
<%= namelink gatherer.user %><%= " (C)" if gatherer == captain %></td>
<%= namelink gatherer.user %>
<% if gatherer == captain %>
<span class="captain">
<%= icon('star') %>
</span>
<% end %> <% end %>
</tr> <% end %>
</li>
<% end %> <% end %>
<% if pick %> <% if pick %>
>> <a href="javascript:;" class="submit">Pick</a> <a class="button tiny">Pick</a>
<% end %> <% end %>
</table> </table>
<% end %> <% end %>

View file

@ -1,16 +1,16 @@
<div class="box gatherLeftBox left"> <div class="data players">
<%= render :partial => "gatherers/list", :locals => {:team => nil} %> <%= render partial: "gatherers/list", locals: { team: nil } %>
</div> </div>
<div class="box gatherMiddleBox left"> <div class="data players">
<%= render :partial => "gatherers/list", :locals => {:team => 1} %> <%= render partial: "gatherers/list", locals: { team: 1 } %>
</div> </div>
<div class="box gatherRightBox left"> <div class="data players">
<%= render :partial => "gatherers/list", :locals => {:team => 2} %> <%= render partial: "gatherers/list", locals: { team: 2 } %>
</div> </div>
<%= render :partial => "status" %> <%= render partial: "status" %>
<% if @gatherer and @gatherer.user_id = 176 %> <% if @gatherer and @gatherer.user_id = 176 %>
<div id="gatherStarted"></div> <div id="gatherStarted"></div>

View file

@ -1,24 +1,21 @@
<div class="box gatherLeftBox left"> <div class="data players">
<h2 class="center"> <h4>Signed Up</h4>
Signed Up
</h2>
<table id="gatherersTable">
<ul id="gatherers">
<% @gather.gatherers.each do |gatherer| %> <% @gather.gatherers.each do |gatherer| %>
<tr class="<%= cycle('even', 'odd') %>" height="18"> <li>
<td><%= flag gatherer.user.country %></td> <%= flag gatherer.user.country %>
<td><%= namelink gatherer.user %></td> <%= namelink gatherer.user %>
<%# if gatherer.can_destroy? cuser %>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<td>[<%= link_to "X", gatherer, :method => :delete %>]</td> <%= link_to gatherer, method: :delete, class: 'delete' do %>
<%= icon 'times' %>
<% end %> <% end %>
<% end %> <% end %>
</li>
</table> <% end %>
</ul>
</div> </div>
<%= render :partial => "votes" %> <%= render partial: 'votes' %>
<%= render partial: 'status' %>
<%= render :partial => "status" %>

View file

@ -1,34 +1,41 @@
<div class="box left wide" id="gatherStatus"> <div id="gather-stats">
<% if @gather.status == Gather::STATE_RUNNING %> <% if @gather.status == Gather::STATE_RUNNING %>
<% if @gatherer and @gatherer.can_destroy? cuser %> <% if @gatherer and @gatherer.can_destroy? cuser %>
Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed. <p>Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.</p>
<%= link_to 'Leave Gather', @gatherer, :confirm => 'Are you sure?', :method => :delete %> <%= 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) %>
<% elsif (g = Gatherer.new(gather: @gather, user: cuser)).can_create?(cuser) %>
<%= form_for g do |f| %> <%= form_for g do |f| %>
<%= f.hidden_field :gather_id %> <%= f.hidden_field :gather_id %>
<%= f.hidden_field :user_id %> <%= f.hidden_field :user_id %>
<p>
Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed. <p>Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.</p>
</p>
<p> <p>
You can download custom maps via the You can download custom maps via the
<%= link_to "Steam Workshop", "http://steamcommunity.com/workshop/browse?searchtext=&childpublishedfileid=0&section=items&appid=4920&browsesort=trend&requiredtags%5B%5D=level" %>. <%= link_to "Steam Workshop", "http://steamcommunity.com/workshop/browse?searchtext=&childpublishedfileid=0&section=items&appid=4920&browsesort=trend&requiredtags%5B%5D=level" %>.
</p> </p>
<p> <p>
<% if cuser.gatherers.count < 5 %> <% 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. <%= f.check_box :confirm %> I have read the <%= link_to "rules", article_url(Article::G_RULES) %>, installed NS and Teamspeak3.
<% end %> <% end %>
<a href="javascript:" id="gatherJoinBtn"> <a href="javascript:" id="gatherJoinBtn" class="button">
Click to join gather! Click to join gather!
</a> </a>
</p> </p>
<% end %> <% end %>
<% else %> <% else %>
Log in to join the gather. <p>Log in to join the gather.p</p>
<% end %> <% end %>
<% elsif @gather.status == Gather::STATE_VOTING %> <% elsif @gather.status == Gather::STATE_VOTING %>
Please vote captains and maps. <p>Please vote captains and maps.</p>
<% elsif @gather.status == Gather::STATE_PICKING %> <% elsif @gather.status == Gather::STATE_PICKING %>
<p>
<% if @gatherer and @gatherer.captain? %> <% if @gatherer and @gatherer.captain? %>
<% if @gatherer.turn? %> <% if @gatherer.turn? %>
It is your turn, please pick a player from the lobby! It is your turn, please pick a player from the lobby!
@ -36,8 +43,10 @@
Wait for the other captain to pick. Wait for the other captain to pick.
<% end %> <% end %>
<% else %> <% else %>
Captains are picking the teams, please wait. Are you a panda ? <br /> Captains are picking the teams, please wait. Are you a panda?<br>
<% end %> <% end %>
</p>
<% elsif @gather.status == Gather::STATE_FINISHED and @gather.server %> <% elsif @gather.status == Gather::STATE_FINISHED and @gather.server %>
Gather finished, join the Gather finished, join the
<% if @gather.server and @gather.server.ip and @gather.server.password %> <% if @gather.server and @gather.server.ip and @gather.server.password %>
@ -45,19 +54,16 @@
<% else %> <% else %>
Server Server
<% end %> <% end %>
and TS3. <br /> and TS3. <br>
Maps: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %> <br />
Maps: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %> <br>
Server: <% if @gather.server %> Server: <% if @gather.server %>
<%= @gather.server %> <%= @gather.server %>
(<%= @gather.server.ip %>:<%= @gather.server.port %> ; password = <%= if @gather.server.password then @gather.server.password else "<Password not specified>" end %>) (<%= @gather.server.ip %>:<%= @gather.server.port %> ; password = <%= if @gather.server.password then @gather.server.password else "<Password not specified>" end %>)
<% end %> <% end %>
<% end %> <% end %>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<p> <%= link_to "Admin Page", edit_gather_url, class: 'admin button' %>
<%= link_to "Admin Page", edit_gather_url() %>
</p>
<% end %> <% end %>
</div> </div>
<div class="clear"></div>

View file

@ -1,68 +1,53 @@
<% vote_maps, vote_servers = false %> <% vote_maps, vote_servers = false %>
<div class="box gatherMiddleBox left"> <div class="data servers">
<h2 class="center"> <h4>Server Votes</h4>
Server voting
</h2>
<table class="gatherVotes"> <ul class="votes">
<% @gather.gather_servers.ordered.each do |server| %> <% @gather.gather_servers.ordered.each do |server| %>
<tr> <li>
<td> <span class="count">
<%= if server.votes then server.votes else "0" end %> <%= if server.votes then server.votes else "0" end %>
</td> </span>
<td> <% if server.real_votes.build(user: cuser).can_create? cuser %>
<% if server.real_votes.build(:user => cuser).can_create? cuser %> <%= link_to server,
<%= link_to shorten(server, 15), controller: "votes", action: "create",
:controller => "votes", :action => "create", vote: { votable_id: server.id, votable_type: "GatherServer" },
:vote => {:votable_id => server.id, :votable_type => "GatherServer"}, method: "post" %>
:method => "post" %>
<% vote_servers = true else %> <% vote_servers = true else %>
<%= shorten server, 15 %> <%= server %>
<% end %> <% end %>
</td> </li>
</tr>
<% end %> <% end %>
</table> </ul>
<% if vote_servers %> <% if vote_servers %>
<p class="center"> <p>Click to vote</p>
Click to vote. <p><%= link_to "More servers", { controller: :servers }, { class: 'button tiny' } %></p>
</p>
<p class="center">
<%= link_to "Moar servers", :controller => :servers %>
</p>
<% end %> <% end %>
</div> </div>
<div class="box gatherRightBox left"> <div class="data">
<h2 class="center"> <h4>Map Votes</h4>
Vote Maps
</h2>
<table class="gatherVotes"> <ul class="votes">
<% @gather.gather_maps.ordered.each do |map| %> <% @gather.gather_maps.ordered.each do |map| %>
<tr> <li>
<td> <span><%= map.votes %></span>
<%= map.votes %> <% if map.real_votes.build(user: cuser).can_create? cuser %>
</td>
<td>
<% if map.real_votes.build(:user => cuser).can_create? cuser %>
<%= link_to shorten(map, 15), <%= link_to shorten(map, 15),
:controller => "votes", :action => "create", controller: "votes", action: "create",
:vote => {:votable_id => map.id, :votable_type => "GatherMap"}, vote: { votable_id: map.id, votable_type: "GatherMap" },
:method => "post" %> method: "post" %>
<% vote_maps = true else %> <% vote_maps = true %>
<% else %>
<%= shorten map, 15 %> <%= shorten map, 15 %>
<% end %> <% end %>
</td> </li>
</tr>
<% end %> <% end %>
</table> </ul>
<% if vote_maps %> <% if vote_maps %>
<p class="center"> <p>Click to vote</p>
Click to vote.
</p>
<% end %> <% end %>
</div> </div>

View file

@ -1,36 +1,29 @@
<% if @gatherer and cuser %> <div class="data">
<!-- Gather:<%= headers["Gather"] %> --> <h4>Vote Captains</h4>
<% end %>
<div class="box gatherLeftBox left"> <table id="gatherers">
<h2 class="center">
Vote Captains
</h2>
<table id="gatherersTable">
<% @gather.gatherers.most_voted.each do |gatherer| %> <% @gather.gatherers.most_voted.each do |gatherer| %>
<tr class="<%= cycle('even', 'odd') %>" height="18"> <tr>
<td><%= flag gatherer.user.country %></td> <td><%= flag gatherer.user.country %></td>
<td>(<%= gatherer.votes %>) <td>
<% 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), <%= link_to (h gatherer.user),
:controller => "votes", :action => "create", controller: "votes", action: "create",
:vote => {:votable_id => gatherer.id, :votable_type => "Gatherer"}, vote: { votable_id: gatherer.id, votable_type: "Gatherer"},
:method => "post" %></td> method: "post" %>
<% else %> <% else %>
<%= namelink gatherer.user %></td> <%= namelink gatherer.user %>
<% end %> <% end %>
</td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<% if @gatherer %> <% if @gatherer %>
<p class="center"> <p>Click to vote for captain.</p>
Click to vote for captain.
</p>
<% end %> <% end %>
</div> </div>
<%= render :partial => "votes" %> <%= render partial: 'votes' %>
<%= render partial: 'status' %>
<%= render :partial => "status" %>

View file

@ -1,3 +1,4 @@
<div id="jplayer"></div>
<script type="text/javascript"> <script type="text/javascript">
var played = false; var played = false;
@ -10,7 +11,7 @@
success: function(response) { success: function(response) {
if (response.match(/Gather:voting/)) { if (response.match(/Gather:voting/)) {
if (!played) { if (!played) {
$("#jquery_jplayer_1").jPlayer({ $("#jplayer").jPlayer({
ready: function() { ready: function() {
$(this).jPlayer("setMedia", { $(this).jPlayer("setMedia", {
mp3: "http://www.ensl.org/sounds/gather-5.mp3" mp3: "http://www.ensl.org/sounds/gather-5.mp3"
@ -18,7 +19,7 @@
var click = document.ontouchstart === undefined ? 'click' : 'touchstart'; var click = document.ontouchstart === undefined ? 'click' : 'touchstart';
var kickoff = function () { var kickoff = function () {
$("#jquery_jplayer_1").jPlayer("play"); $("#jplayer").jPlayer("play");
document.documentElement.removeEventListener(click, kickoff, true); document.documentElement.removeEventListener(click, kickoff, true);
}; };
@ -33,75 +34,77 @@
} }
} }
else if (response.length > 10) { else if (response.length > 10) {
$("#jquery_jplayer_1").jPlayer("stop"); $("#jplayer").jPlayer("stop");
} }
} }
}); });
}); });
</script> </script>
<div id="jquery_jplayer_1"></div> <div id="gather">
<h1 class="fancy">
<div class="wide"> <span>
<h2 class="center">
<div class="left">
<small><small><%= link_to raw("&#171;&#171; First"), @gather.first %></small></small>
<%= link_to raw("Previous &#8249;&#8249;"), @gather.previous_gather %>
</div>
<%= link_to @gather do %> <%= link_to @gather do %>
<%= @gather.category.to_s %> Gather <%= @gather.category.to_s %> Gather
<% end %> <% end %>
<div class="right"> </span>
<% if @gather.next_gather %> </h1>
<%= link_to raw("&#8250;&#8250; Next"), @gather.next_gather%>
<small><small><%= link_to raw("Last &#187;&#187;"), @gather.last %></small></small> <div class="previous">
<% else %> <%= link_to @gather.previous_gather, class: 'button tiny' do %>
<%= raw("&#8250;&#8250; Next") %> <%= icon 'chevron-left' %> Previous
<small><small><%= raw("Last &#187;&#187;") %></small></small> <% end %>
</div>
<div class="next">
<% if @gather.next_gather %>
<%= link_to @gather.next_gather, class: 'button tiny' do %>
Next <%= icon 'chevron-right' %>
<% end %>
<% end %> <% end %>
</div> </div>
</h2>
<% if @gather and @gather.status != Gather::STATE_FINISHED %> <% if @gather and @gather.status != Gather::STATE_FINISHED %>
<div class="box wide" id="gatherInfo"> <div id="gather-info">
<h3 class="center"> <div class="info">
<h6>Requirements</h6>
<ul>
<li><a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=12654">JavaScript</a> enabled</li>
<li>Read the <%= link_to "Gather Rules", article_url(Article::G_RULES) %></li>
<li>Remove yourself if you leave</li>
</ul>
</div>
</h3> <div class="info">
<h6>Captains</h6>
<ul>
<li>Vote for the <strong>best</strong> players</li>
<li>Captain 1 = 2nd most voted</li>
<li>Captain 2 = 1st most voted</li>
</ul>
</div>
<table class="wide" id="gatherInfoText"> <div class="info">
<tr> <h6>Voice Comunication</h6>
<td> <ul>
<b>Requirements</b><br /> <li><%= link_to "Teamspeak 3", "http://www.teamspeak.com/?page=downloads" %></li>
- <a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=12654">Javascript</a> needs to enabled<br /> <li><strong>Server:</strong> <a href="ts3server://ensl.org">ensl.org</a></li>
- Read <%= link_to "gather rules", article_url(Article::G_RULES) %> <br /> <li><strong>Password:</strong> ns2nsl</li>
- Remove yourself if you leave </ul>
</td> </div>
<td> <div class="hide">
<b>Captains:</b><br /> <a id="gather-info-hide" class="button tiny">
- Vote for the <b>best</b> players<br /> <%= icon 'times' %>
- Captain 1 = 2nd most voted<br /> Hide information
- Captain 2 = 1st most voted<br /> </a>
</td>
<td>
<b>Voice Comunication:</b><br />
- <%= link_to "Teamspeak 3", "http://www.teamspeak.com/?page=downloads" %> <br />
- <b>Server:</b> <a href="ts3server://ensl.org">ensl.org</a><br />
- <b>Password:</b> ns2nsl
</td>
</tr>
</table>
<div class="center">
<a href="javascript:;" id="gatherInfoHide">Hide information</a>
</div> </div>
</div> </div>
<% end %> <% end %>
<div id="gatherArea"> <div id="gather-area">
<%= render_gather %> <%= render_gather %>
</div> </div>
<%= render :partial => "shoutmsgs/index", :locals => {:object => @gather} %> <%= render partial: 'shoutmsgs/index', locals: { object: @gather } %>
</div> </div>

View file

@ -1,2 +1,2 @@
$("div#gatherArea").children().hide(); $("div#gather-area").children().hide();
$("div#gatherArea").html("<%= escape_javascript(render_gather) %>"); $("div#gather-area").html("<%= escape_javascript(render_gather) %>");

View file

@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<title>ENSL</title>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" type="image/png" href="/favicon.png" />
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="container">
<%= render partial: "header" %>
<div class="wrapper">
<%= render partial: "navigation" %>
<div id="content">
<%= render partial: "messages" %>
<%= yield %>
<%= render partial: "gather" %>
</div>
</div>
<%= render partial: "footer" %>
</div>
</body>
</html>

View file

@ -9,10 +9,10 @@
}); });
</script> </script>
<% 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) %>
<div class="wide box shoutmsgBox" id="<%= shoutmsg_new.domain %>"> <div id="<%= shoutmsg_new.domain %>" class="shoutbox-messages">
<%= render :partial => "shoutmsgs/shoutmsg", :collection => object.shoutmsgs.recent.reverse, :locals => {:popup => "this"} %> <%= render partial: "shoutmsgs/shoutmsg", collection: object.shoutmsgs.recent.reverse, locals: { popup: 'this' } %>
</div> </div>
<%= render :partial => "shoutmsgs/new", :locals => {:shoutmsg => shoutmsg_new, :popup => "this"} %> <%= render partial: "shoutmsgs/new", locals: { shoutmsg: shoutmsg_new, popup: "this" } %>

View file

@ -3,7 +3,7 @@
You have been muted. You have been muted.
<% else %> <% else %>
<% scroll = shoutmsg.domain == "shoutbox" ? "" : "$('#{shoutmsg.domain}').scrollTop = $('#{shoutmsg.domain}').scrollHeight;" %> <% 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 %> <% if shoutmsg.shoutable %>
<%= f.hidden_field :shoutable_type %> <%= f.hidden_field :shoutable_type %>
<%= f.hidden_field :shoutable_id %> <%= f.hidden_field :shoutable_id %>

View file

@ -1,10 +1,12 @@
<div class="shoutmsg"> <div class="shoutmsg">
<% if shoutmsg.can_destroy? cuser %> <% if shoutmsg.can_destroy? cuser %>
<%= link_to icon('times'), shoutmsg, :method => :delete %> <%= link_to icon('times'), shoutmsg, method: :delete %>
<% end %> <% end %>
<%# if shoutmsg.domain != "shoutbox" %>
[<%= shoutmsg.created_at ? shoutmsg.created_at.strftime("%H:%M") : Time.now.strftime("%H:%M") %>] <span class="timestamp">
<%# end %> <%= shoutmsg.created_at ? shoutmsg.created_at.strftime("%H:%M") : Time.now.strftime("%H:%M") %>
</span>
<%= namelink shoutmsg.user %>: <%= namelink shoutmsg.user %>:
<%= shoutmsg.text %><br /> <%= shoutmsg.text %><br />
</div> </div>

View file

@ -4,7 +4,3 @@
<div id="teams"> <div id="teams">
<%= render partial: 'list', locals: { teams: @teams } %> <%= render partial: 'list', locals: { teams: @teams } %>
</div> </div>
<script type="text/javascript">
new Yetii({id: 'teamsTab'});
</script>

View file

@ -20,7 +20,7 @@
<div class="tabbed-contents"> <div class="tabbed-contents">
<div class="tab" id="general"> <div class="tab" id="general">
<dl> <dl>
<dt>Irc:</dt> <dt>IRC:</dt>
<dd><%=h @team.irc %></dd> <dd><%=h @team.irc %></dd>
<dt>Web:</dt> <dt>Web:</dt>
<dd><%=h @team.web %></dd> <dd><%=h @team.web %></dd>
@ -45,8 +45,10 @@
<h3>Current Members</h3> <h3>Current Members</h3>
<%= render partial: "teamers/list", locals: { teamers: @team.teamers.active.ordered.distinct, blacklist: false, comment: true } %> <%= render partial: "teamers/list", locals: { teamers: @team.teamers.active.ordered.distinct, blacklist: false, comment: true } %>
<% if @team.teamers.past.distinct.length > 0 %>
<h3>Past Members</h3> <h3>Past Members</h3>
<%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %> <%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %>
<% end %>
</div> </div>
<div class="tab" id="matches"> <div class="tab" id="matches">
@ -62,7 +64,7 @@
<div class="tab" id="matches"> <div class="tab" id="matches">
<dl> <dl>
<dt>Matches:</dt> <dt>Matches:</dt>
<dd><%= @team.matches_finished.count %> dllayed / <%= @team.matches.count %> total</dd> <dd><%= @team.matches_finished.count %> played / <%= @team.matches.count %> total</dd>
<dt>Won:</dt> <dt>Won:</dt>
<dd><%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %)</dd> <dd><%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %)</dd>
<dt>Lost:</dt> <dt>Lost:</dt>

View file

@ -1,286 +1,165 @@
<h1>Profile: <%= h @user.username %></h1> <h1>Account: <%= h @user.username %></h1>
<%= 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| %> <% f.fields_for :profile do |p| %>
<div id="user" class="tabbed"> <div id="user" class="tabbed">
<ul id="user-nav" class="tabs"> <ul id="user-nav" class="tabs">
<li><a href="#userTabGeneral">General</a></li> <li><a href="#account">Account</a></li>
<li><a href="#userTabContact">Contact</a></li> <li><a href="#profile">Profile</a></li>
<li><a href="#userTabCountry"><%= t('profile.locals') %></a></li> <li><a href="#country"><%= t('profile.locals') %></a></li>
<li><a href="#userTabFavorites">Favorites</a></li> <li><a href="#notifications">Notifications</a></li>
<li><a href="#userTabSettings">Settings</a></li>
<li><a href="#userTabComputer">Computer</a></li>
<li><a href="#userTabExtra">Extra</a></li>
<li><a href="#notifications">Notify</a></li>
</ul> </ul>
<div class="tabbed-contents"> <div class="tabbed-contents">
<div class="tab" id="userTabGeneral"> <div class="tab" id="account">
<% if @user.errors.any? %> <% if @user.errors.any? %>
<div id="error_explanation"> <div id="errors">
<h2> <strong><%= pluralize(@user.errors.count, t(:error)) %></strong>
<%= pluralize(@user.errors.count, t(:error)) %> <ul class="errors">
</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %> <% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li> <li><%= msg %></li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
<% end %> <% end %>
<p> <div class="fields horizontal">
<%= f.label :username, 'Username', :class => 'required' %><br /> <%= f.label :username, 'Username', class: 'required' %>
<%= f.text_field :username %> <%= f.text_field :username %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :raw_password, "Password" %><br /> <%= f.label :raw_password, "Password" %>
<%= f.password_field :raw_password %> <%= f.password_field :raw_password %>
</p>
<p>
<%= f.label :firstname %> (only available to members)<br />
<%= f.text_field :firstname %>
</p>
<p>
<%= f.label :lastname %> (only available to members)<br />
<%= f.text_field :lastname %>
</p>
<p>
<%= f.label :steamid %><br />
<%= f.text_field :steamid %>
</p>
<p>
<%= f.label :birthdate %><br />
<%= date_select :user, :birthdate, :order => [:year, :month, :day], :default => @user.birthdate, :start_year => 1950 %>
</p>
</div> </div>
<div class="fields horizontal">
<div class="tab" id="userTabContact"> <%= f.label :email do %>
<p> <p>Email</p>
<%= f.label :email %> (only available to admins)<br /> <em>(only visible to admins)</em>
<% end %>
<%= f.text_field :email %> <%= f.text_field :email %>
</p> </div>
<p> <div class="fields horizontal">
<%= f.label :public_email %><br /> <%= f.label :public_email %>
<%= f.check_box :public_email %> <%= f.check_box :public_email %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :steam_profile, "Link to your Steam Profile" %><br /> <%= f.label :steamid %>
<%= f.text_field :steamid, html: { placeholder: 'http://steamcommunity.com/id/...' } %>
</div>
<div class="fields horizontal">
<%= f.label :firstname do %>
<p>First Name</p>
<em>(only visible to members)</em>
<% end %>
<%= f.text_field :firstname %>
</div>
<div class="fields horizontal">
<%= f.label :lastname do %>
<p>Last Name</p>
<em>(only visible to members)</em>
<% end %>
<%= f.text_field :lastname %>
</div>
<div class="fields horizontal">
<%= f.label :birthdate %>
<div class="inputs">
<%= date_select :user, :birthdate, order: [:year, :month, :day], default: @user.birthdate, start_year: 1950 %>
</div>
</div>
</div>
<div class="tab" id="profile">
<div class="fields horizontal">
<%= p.label :steam_profile, "Steam Profile URL" %>
<%= p.text_field :steam_profile %> <%= p.text_field :steam_profile %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :irc %><br /> <%= p.label :web %>
<%= p.text_field :irc %>
</p>
<p>
<%= p.label :msn %><br />
<%= p.text_field :msn %>
</p>
<p>
<%= p.label :icq %><br />
<%= p.text_field :icq %>
</p>
<p>
<%= p.label :web %><br />
<%= p.text_field :web %> <%= p.text_field :web %>
</p> </div>
<div class="fields horizontal">
<%= p.label :achievements %>
<%= p.text_area :achievements, rows: 5 %>
</div> </div>
<div class="tab" id="userTabCountry"> <div class="fields horizontal">
<p> <%= p.label :signature %>
<%= f.label :country %><br /> <%= p.text_area :signature, rows: 5 %>
<%= country_code_select :user, :country %>
</p>
<p>
<%= p.label :town %><br />
<%= p.text_field :town %>
</p>
<p>
<%= f.label :time_zone %><br />
<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.all %>
<br />
Daylight savings will be observed automatically.
</p>
</div> </div>
<div class="tab" id="userTabFavorites"> <div class="fields horizontal">
<p> <label>Avatar</label>
<%= p.label :singleplayer %><br />
<%= p.text_field :singleplayer %>
</p>
<p>
<%= p.label :multiplayer %><br />
<%= p.text_field :multiplayer %>
</p>
<p>
<%= p.label :food %><br />
<%= p.text_field :food %>
</p>
<p>
<%= p.label :beverage %><br />
<%= p.text_field :beverage %>
</p>
<p>
<%= p.label :hobby %><br />
<%= p.text_field :hobby %>
</p>
<p>
<%= p.label :music %><br />
<%= p.text_field :music %>
</p>
<p>
<%= p.label :book %><br />
<%= p.text_field :book %>
</p>
<p>
<%= p.label :movie %><br />
<%= p.text_field :movie %>
</p>
<p>
<%= p.label :tvseries %><br />
<%= p.text_field :tvseries %>
</p>
</div>
<div class="tab" id="userTabSettings">
<p>
<%= p.label :res %><br />
<%= p.text_field :res %>
</p>
<p>
<%= p.label :sensitivity %><br />
<%= p.text_field :sensitivity %>
</p>
<p>
<%= p.label :monitor_hz %><br />
<%= p.text_field :monitor_hz %>
</p>
<p>
<%= p.label :scripts %><br />
<%= p.text_field :scripts %>
</p>
</div>
<div class="tab" id="userTabComputer">
<p>
<%= p.label :cpu %><br />
<%= p.text_field :cpu %>
</p>
<p>
<%= p.label :gpu %><br />
<%= p.text_field :gpu %>
</p>
<p>
<%= p.label :ram %><br />
<%= p.text_field :ram %>
</p>
<p>
<%= p.label :psu %><br />
<%= p.text_field :psu %>
</p>
<p>
<%= p.label :motherboard %><br />
<%= p.text_field :motherboard %>
</p>
<p>
<%= p.label :soundcard %><br />
<%= p.text_field :soundcard %>
</p>
<p>
<%= p.label :hdd %><br />
<%= p.text_field :hdd %>
</p>
<p>
<%= p.label :case %><br />
<%= p.text_field :case %>
</p>
<p>
<%= p.label :monitor %><br />
<%= p.text_field :monitor %>
</p>
<p>
<%= p.label :mouse %><br />
<%= p.text_field :mouse %>
</p>
<p>
<%= p.label :mouse_pad %><br />
<%= p.text_field :mouse_pad %>
</p>
<p>
<%= p.label :keyboard %><br />
<%= p.text_field :keyboard %>
</p>
<p>
<%= p.label :head_phones %><br />
<%= p.text_field :head_phones %>
</p>
<p>
<%= p.label :speakers %><br />
<%= p.text_field :speakers %>
</p>
</div>
<div class="tab" id="userTabExtra">
<p>
<%= p.label :achievements %><br />
<%= p.text_area :achievements %>
</p>
<p>
<%= p.label :signature %><br />
<%= p.text_area :signature, :rows => 5, :cols => 50 %>
</p>
<p>
<label>Avatar:</label><br />
<%= p.file_field :avatar %> <%= p.file_field :avatar %>
</p> </div>
</div>
<div class="tab" id="country">
<div class="fields horizontal">
<%= f.label :country %>
<div class="inputs">
<%= country_code_select :user, :country %>
</div>
</div>
<div class="fields horizontal">
<%= p.label :town %>
<%= p.text_field :town %>
</div>
<div class="fields horizontal">
<%= f.label :time_zone %>
<div class="inputs">
<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.all %>
<p>Daylight savings will be observed automatically.</p>
</div>
</div>
</div> </div>
<div class="tab" id="notifications"> <div class="tab" id="notifications">
<p> <h4>Notify me when...</h4>
<%= p.label :notify_news, "Notify me when news are posted" %><br />
<div class="fields horizontal">
<%= p.label :notify_news, "News item are posted" %>
<%= p.check_box :notify_news %> <%= p.check_box :notify_news %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_articles, "Notify me of new articles" %><br /> <%= p.label :notify_articles, "New articles" %>
<%= p.check_box :notify_articles %> <%= p.check_box :notify_articles %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_movies, "Notify me of new movies" %><br /> <%= p.label :notify_movies, "New movies" %>
<%= p.check_box :notify_movies %> <%= p.check_box :notify_movies %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_gather, "Notify me when gather has 6 players" %><br /> <%= p.label :notify_gather, "Gather has 6 players" %>
<%= p.check_box :notify_gather %> <%= p.check_box :notify_gather %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_own_match, "Notify me of my team's matches" %><br /> <%= p.label :notify_own_match, "My team's matches" %>
<%= p.check_box :notify_own_match %> <%= p.check_box :notify_own_match %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_any_match, "Notify me of any new match" %><br /> <%= p.label :notify_any_match, "New matches" %>
<%= p.check_box :notify_any_match %> <%= p.check_box :notify_any_match %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_challenge, "Notify me of new challenges" %><br /> <%= p.label :notify_challenge, "New challenges" %>
<%= p.check_box :notify_challenge %> <%= p.check_box :notify_challenge %>
</p> </div>
<p> <div class="fields horizontal">
<%= p.label :notify_pms, "Notify me of private messages" %><br /> <%= p.label :notify_pms, "Private messages" %>
<%= p.check_box :notify_pms %> <%= p.check_box :notify_pms %>
</p>
</div> </div>
</div> </div>
<p> </div>
<div class="controls">
<%= f.submit %> <%= f.submit %>
</p> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>

View file

@ -3,7 +3,7 @@
<ul> <ul>
<li> <li>
<%= link_to edit_user_path(cuser) do %> <%= link_to edit_user_path(cuser) do %>
<%= icon 'user' %> Profile <%= icon 'user' %> Account
<% end %> <% end %>
</li> </li>
<li> <li>

View file

@ -1,7 +1,7 @@
<div class="widget shoutbox"> <div class="widget shoutbox">
<h4><%= t('widget.shoutbox') %></h4> <h4><%= t('widget.shoutbox') %></h4>
<div class="widget-content-wrapper"> <div class="widget-content-wrapper">
<div class="transcript"> <div id="shoutbox" class="transcript">
<%= render :partial => "shoutmsgs/shoutmsg", :collection => Shoutmsg.recent.box, :locals => {:popup => "$('shoutbox')"} %> <%= render :partial => "shoutmsgs/shoutmsg", :collection => Shoutmsg.recent.box, :locals => {:popup => "$('shoutbox')"} %>
</div> </div>
</div> </div>

View file

@ -12,7 +12,8 @@ set :rbenv_type, :user
set :rbenv_ruby, '2.1.1' set :rbenv_ruby, '2.1.1'
set :dotenv_role, [:app, :web] 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 :writable_dirs, %w{public tmp}
set :linked_files, %w{.env} set :linked_files, %w{.env}
@ -42,8 +43,49 @@ namespace :deploy do
end end
task :restart do task :restart do
invoke 'unicorn:restart' invoke 'puma:restart'
end end
after :publishing, :restart after :publishing, :restart
end 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

View file

@ -32,5 +32,5 @@ Ensl::Application.configure do
config.cache_store = :dalli_store config.cache_store = :dalli_store
# Enable threaded mode # Enable threaded mode
config.threadsafe! # config.threadsafe!
end end

View file

@ -32,7 +32,4 @@ Ensl::Application.configure do
# Print deprecation notices to the stderr # Print deprecation notices to the stderr
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Enable threaded mode
config.threadsafe!
end end

View file

@ -18,6 +18,7 @@ en:
contests_update: "Contest was successfully updated." contests_update: "Contest was successfully updated."
contests_join: "Team successfully joined contest." contests_join: "Team successfully joined contest."
contests_contester_update: "Contester was successfully updated." contests_contester_update: "Contester was successfully updated."
gather_create: "New Gather was started successfully."
gathers_join: "You have joined the Gather." gathers_join: "You have joined the Gather."
files_create: "File was successfully created." files_create: "File was successfully created."
files_update: "File was successfully updated." files_update: "File was successfully updated."

39
config/puma.rb Normal file
View file

@ -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

View file

@ -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

View file

@ -1,5 +1,7 @@
#!/usr/bin/env ruby.exe #!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
require 'rack/handler'
Rack::Handler::WEBrick = Rack::Handler.get(:puma)
APP_PATH = File.expand_path('../../config/application', __FILE__) APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__) require File.expand_path('../../config/boot', __FILE__)