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

View file

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

View file

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

View file

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

View file

@ -9,5 +9,21 @@
//= require_self
$ ->
$("#logout").click ->
$(this).closest("form").submit()
$('logout').click ->
$(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
$("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() {

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,7 @@
/*
Users Listing
*/
#users {
table-layout: auto;
@ -19,3 +23,33 @@
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
def show
render layout: 'full'
end
def latest

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
<div id="gather">
<div id="gather-status">
<% 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 %>

View file

@ -23,7 +23,7 @@
<ul>
<li><%= link_to "Staff", controller: "about", action: "staff" %></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 "Bans", bans_url %></li>
<li><%= link_to "Contact", new_issue_path %></li>

View file

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

View file

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

View file

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

View file

@ -2,24 +2,23 @@
<div class="contest info">
<h3>Details</h3>
<p>
<strong>From-to</strong>:<br>
<%= longdate @contest.start %> <br> <%= longdate @contest.end %>
</p>
<p>
<strong>Rules</strong>:<br>
<%= namelink @contest.rules %>
</p>
<p>
<b>Status:</b><br>
<%= @contest.statuses[@contest.status] %>
</p>
<p>
<b>Default:</b><br>
Sunday: <%= h @contest.default_time.strftime("%H:%M") %>
</p>
<dl>
<dt>Start - End</dt>
<dd>
<%= longdate @contest.start %><br>
<%= longdate @contest.end %>
</dd>
<dt>Rules</dt>
<dd><%= namelink @contest.rules %></dd>
<dt>Status</dt>
<dd><%= @contest.statuses[@contest.status] %></dd>
<dt>Default</dt>
<dd>Sunday: <%=h @contest.default_time.strftime("%H:%M") %></dd>
</dl>
<% 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 @@
</div>
<% 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 %>
<div id="contestTab" class="clear wide">
<ul id="contestTab-nav" class="tabs">
<div id="contest" class="tabbed">
<ul id="contest-nav" class="tabs">
<li><a href="#results">Matches</a></li>
<li><a href="#predictions">Predictions</a></li>
<li><a href="#maps">Maps</a></li>
</ul>
<div class="box wide2 tabs">
<div class="tabbed-contents">
<div class="tab" id="results">
<h3>
Matches Played
@ -172,5 +171,7 @@
</div>
<script type="text/javascript">
var tabber1 = new Yetii({id: 'contestTab'});
new Yetii({
id: 'contest'
});
</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 %>
<% pick = false %>
<h2 class="center">
<h4>
<%= if team.nil? then "Lobby" else team == 1 ? "Marines" : "Aliens" end %>
</h2>
</h4>
<%= form_tag("/gathers/pick/#{@gather.id}") do %>
<table id="gatherersTable">
<ul class="gatherers">
<% @gather.gatherers.ordered.team(team).each do |gatherer| %>
<tr height="10">
<% if @gatherer and gatherer.can_update? cuser, {:team => @gatherer.team} %>
<li>
<% if @gatherer and gatherer.can_update? cuser, { team: @gatherer.team } %>
<% pick = true %>
<td><%= radio_button_tag :player, gatherer.id %><%= flag gatherer.user.country %></td>
<td><%= namelink gatherer.user %></td>
<%= radio_button_tag :player, gatherer.id %><%= flag gatherer.user.country %>
<%= namelink gatherer.user %>
<% 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 %>
<td>&#187;
<% else %>
<td>
<%= icon 'chevron-right' %>
<% end %>
<%= namelink gatherer.user %><%= " (C)" if gatherer == captain %></td>
<%= namelink gatherer.user %>
<% if gatherer == captain %>
<span class="captain">
<%= icon('star') %>
</span>
<% end %>
</tr>
<% end %>
</li>
<% end %>
<% if pick %>
>> <a href="javascript:;" class="submit">Pick</a>
<a class="button tiny">Pick</a>
<% end %>
</table>
<% end %>

View file

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

View file

@ -1,24 +1,21 @@
<div class="box gatherLeftBox left">
<h2 class="center">
Signed Up
</h2>
<div class="data players">
<h4>Signed Up</h4>
<table id="gatherersTable">
<ul id="gatherers">
<% @gather.gatherers.each do |gatherer| %>
<tr class="<%= cycle('even', 'odd') %>" height="18">
<td><%= flag gatherer.user.country %></td>
<td><%= namelink gatherer.user %></td>
<%# if gatherer.can_destroy? cuser %>
<li>
<%= flag gatherer.user.country %>
<%= namelink gatherer.user %>
<% 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 %>
</table>
</li>
<% end %>
</ul>
</div>
<%= render :partial => "votes" %>
<%= render :partial => "status" %>
<%= render partial: 'votes' %>
<%= 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 @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) %>
<p>Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.</p>
<%= 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 %>
<p>
Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.
</p>
<p>Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.</p>
<p>
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" %>.
</p>
<p>
<% 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 %>
<a href="javascript:" id="gatherJoinBtn">
<a href="javascript:" id="gatherJoinBtn" class="button">
Click to join gather!
</a>
</p>
<% end %>
<% else %>
Log in to join the gather.
<p>Log in to join the gather.p</p>
<% end %>
<% elsif @gather.status == Gather::STATE_VOTING %>
Please vote captains and maps.
<p>Please vote captains and maps.</p>
<% elsif @gather.status == Gather::STATE_PICKING %>
<p>
<% if @gatherer and @gatherer.captain? %>
<% if @gatherer.turn? %>
It is your turn, please pick a player from the lobby!
@ -36,8 +43,10 @@
Wait for the other captain to pick.
<% end %>
<% 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 %>
</p>
<% 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. <br />
Maps: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %> <br />
and TS3. <br>
Maps: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %> <br>
Server: <% if @gather.server %>
<%= @gather.server %>
(<%= @gather.server.ip %>:<%= @gather.server.port %> ; password = <%= if @gather.server.password then @gather.server.password else "<Password not specified>" end %>)
<% end %>
<% end %>
<% if cuser and cuser.admin? %>
<p>
<%= link_to "Admin Page", edit_gather_url() %>
</p>
<%= link_to "Admin Page", edit_gather_url, class: 'admin button' %>
<% end %>
</div>
<div class="clear"></div>

View file

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

View file

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

View file

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

View file

@ -1,2 +1,2 @@
$("div#gatherArea").children().hide();
$("div#gatherArea").html("<%= escape_javascript(render_gather) %>");
$("div#gather-area").children().hide();
$("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>
<% 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 %>">
<%= render :partial => "shoutmsgs/shoutmsg", :collection => object.shoutmsgs.recent.reverse, :locals => {:popup => "this"} %>
<div id="<%= shoutmsg_new.domain %>" class="shoutbox-messages">
<%= render partial: "shoutmsgs/shoutmsg", collection: object.shoutmsgs.recent.reverse, locals: { popup: 'this' } %>
</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.
<% 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 %>

View file

@ -1,10 +1,12 @@
<div class="shoutmsg">
<% 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 %>
<span class="timestamp">
<%= shoutmsg.created_at ? shoutmsg.created_at.strftime("%H:%M") : Time.now.strftime("%H:%M") %>
</span>
<%= namelink shoutmsg.user %>:
<%= shoutmsg.text %><br />
</div>

View file

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

View file

@ -20,7 +20,7 @@
<div class="tabbed-contents">
<div class="tab" id="general">
<dl>
<dt>Irc:</dt>
<dt>IRC:</dt>
<dd><%=h @team.irc %></dd>
<dt>Web:</dt>
<dd><%=h @team.web %></dd>
@ -45,8 +45,10 @@
<h3>Current Members</h3>
<%= 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>
<%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %>
<% end %>
</div>
<div class="tab" id="matches">
@ -62,7 +64,7 @@
<div class="tab" id="matches">
<dl>
<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>
<dd><%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %)</dd>
<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| %>
<div id="user" class="tabbed">
<ul id="user-nav" class="tabs">
<li><a href="#userTabGeneral">General</a></li>
<li><a href="#userTabContact">Contact</a></li>
<li><a href="#userTabCountry"><%= t('profile.locals') %></a></li>
<li><a href="#userTabFavorites">Favorites</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>
<li><a href="#account">Account</a></li>
<li><a href="#profile">Profile</a></li>
<li><a href="#country"><%= t('profile.locals') %></a></li>
<li><a href="#notifications">Notifications</a></li>
</ul>
<div class="tabbed-contents">
<div class="tab" id="userTabGeneral">
<div class="tab" id="account">
<% if @user.errors.any? %>
<div id="error_explanation">
<h2>
<%= pluralize(@user.errors.count, t(:error)) %>
</h2>
<ul>
<div id="errors">
<strong><%= pluralize(@user.errors.count, t(:error)) %></strong>
<ul class="errors">
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :username, 'Username', :class => 'required' %><br />
<div class="fields horizontal">
<%= f.label :username, 'Username', class: 'required' %>
<%= f.text_field :username %>
</p>
<p>
<%= f.label :raw_password, "Password" %><br />
</div>
<div class="fields horizontal">
<%= f.label :raw_password, "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 class="tab" id="userTabContact">
<p>
<%= f.label :email %> (only available to admins)<br />
<div class="fields horizontal">
<%= f.label :email do %>
<p>Email</p>
<em>(only visible to admins)</em>
<% end %>
<%= f.text_field :email %>
</p>
<p>
<%= f.label :public_email %><br />
</div>
<div class="fields horizontal">
<%= f.label :public_email %>
<%= f.check_box :public_email %>
</p>
<p>
<%= p.label :steam_profile, "Link to your Steam Profile" %><br />
</div>
<div class="fields horizontal">
<%= 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>
<p>
<%= p.label :irc %><br />
<%= 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 />
</div>
<div class="fields horizontal">
<%= p.label :web %>
<%= p.text_field :web %>
</p>
</div>
<div class="fields horizontal">
<%= p.label :achievements %>
<%= p.text_area :achievements, rows: 5 %>
</div>
<div class="tab" id="userTabCountry">
<p>
<%= f.label :country %><br />
<%= 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 class="fields horizontal">
<%= p.label :signature %>
<%= p.text_area :signature, rows: 5 %>
</div>
<div class="tab" id="userTabFavorites">
<p>
<%= 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 />
<div class="fields horizontal">
<label>Avatar</label>
<%= 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 class="tab" id="notifications">
<p>
<%= p.label :notify_news, "Notify me when news are posted" %><br />
<h4>Notify me when...</h4>
<div class="fields horizontal">
<%= p.label :notify_news, "News item are posted" %>
<%= p.check_box :notify_news %>
</p>
</div>
<p>
<%= p.label :notify_articles, "Notify me of new articles" %><br />
<div class="fields horizontal">
<%= p.label :notify_articles, "New articles" %>
<%= p.check_box :notify_articles %>
</p>
</div>
<p>
<%= p.label :notify_movies, "Notify me of new movies" %><br />
<div class="fields horizontal">
<%= p.label :notify_movies, "New movies" %>
<%= p.check_box :notify_movies %>
</p>
</div>
<p>
<%= p.label :notify_gather, "Notify me when gather has 6 players" %><br />
<div class="fields horizontal">
<%= p.label :notify_gather, "Gather has 6 players" %>
<%= p.check_box :notify_gather %>
</p>
</div>
<p>
<%= p.label :notify_own_match, "Notify me of my team's matches" %><br />
<div class="fields horizontal">
<%= p.label :notify_own_match, "My team's matches" %>
<%= p.check_box :notify_own_match %>
</p>
</div>
<p>
<%= p.label :notify_any_match, "Notify me of any new match" %><br />
<div class="fields horizontal">
<%= p.label :notify_any_match, "New matches" %>
<%= p.check_box :notify_any_match %>
</p>
</div>
<p>
<%= p.label :notify_challenge, "Notify me of new challenges" %><br />
<div class="fields horizontal">
<%= p.label :notify_challenge, "New challenges" %>
<%= p.check_box :notify_challenge %>
</p>
</div>
<p>
<%= p.label :notify_pms, "Notify me of private messages" %><br />
<div class="fields horizontal">
<%= p.label :notify_pms, "Private messages" %>
<%= p.check_box :notify_pms %>
</p>
</div>
</div>
<p>
</div>
<div class="controls">
<%= f.submit %>
</p>
</div>
</div>
<% end %>
<% end %>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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
# 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__)