Added basic teams pages styling

This commit is contained in:
Luke Barratt 2014-04-13 12:16:51 +01:00
parent 775f5682a4
commit 0112ef9005
42 changed files with 547 additions and 288 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

@ -24,11 +24,11 @@ $large-screen-up: new-breakpoint(min-width $large-screen 8);
*/ */
$open-sans: "Open Sans", sans-serif; $open-sans: "Open Sans", sans-serif;
$monserrat: "Montserrat", sans-serif; $montserrat: "Montserrat", sans-serif;
$sans-serif: $open-sans; $sans-serif: $open-sans;
$base-font-family: $sans-serif; $base-font-family: $sans-serif;
$header-font-family: $monserrat; $header-font-family: $montserrat;
/* /*
Sizes Sizes

View file

@ -26,6 +26,7 @@
@import "components/gather"; @import "components/gather";
@import "components/breadcrumbs"; @import "components/breadcrumbs";
@import "components/pagination"; @import "components/pagination";
@import "components/tabs";
/* /*
Layout Layout
@ -46,3 +47,6 @@
@import "pages/news"; @import "pages/news";
@import "pages/contests"; @import "pages/contests";
@import "pages/forums"; @import "pages/forums";
@import "pages/teams";
@import "pages/users";
@import "pages/matches";

View file

@ -138,3 +138,24 @@ form.square {
@include shift(3); @include shift(3);
} }
} }
form.search {
.query {
@include span-columns(9);
input {
width: 100%;
}
}
.controls {
@include span-columns(3);
@include shift(0);
@include omega;
input {
width: 100%;
}
}
}

View file

@ -0,0 +1,56 @@
/*
Breadcrumbs
*/
.tabbed {
$tabs-border-width: em(1);
$tabs-padding-vertical: em(8);
$tabs-padding-horizontal: em(16);
ul.tabs {
@include span-columns(12);
display: block;
font-family: $montserrat;
height: em(40);
max-height: em(40);
position: relative;
li {
float: left;
display: block;
background-color: $background-primary;
a {
border: $tabs-border-width solid $navbar-border;
padding: $tabs-padding-vertical $tabs-padding-horizontal;
float: left;
display: block;
color: white;
}
&.activeli {
z-index: 100;
background-color: $blue;
a {
padding-bottom: $tabs-padding-vertical + $tabs-border-width;
border-bottom: 0;
}
}
}
}
.tabbed-contents {
@include span-columns(12);
border: $tabs-border-width solid $navbar-border;
padding: em(20);
}
@for $i from 1 through $grid-columns {
ul.tabs-#{$i} {
li {
@include span-columns($i);
}
}
}
}

View file

@ -49,3 +49,35 @@ body {
@include span-columns(3); @include span-columns(3);
@include omega(); @include omega();
} }
/*
Heading styles
*/
h1, h2, h3, h4, h5, h6 {
&.fancy {
text-align: center;
position: relative;
background-color: $light-blue;
&:before {
content: "";
display: block;
border-top: 2px solid $blue;
width: 100%;
height: 2px;
position: absolute;
top: 50%;
z-index: 1;
}
span {
background: inherit;
padding: 0 .5em;
position: relative;
display: inline-block;
z-index: 1;
}
}
}

View file

@ -6,7 +6,7 @@ nav.top {
background-color: $navigation-background; background-color: $navigation-background;
border-bottom: 1px solid $medium-gray; border-bottom: 1px solid $medium-gray;
font-family: $monserrat; font-family: $montserrat;
height: $navigation-height; height: $navigation-height;
width: 100%; width: 100%;
z-index: 999; z-index: 999;
@ -23,7 +23,7 @@ nav.top {
cursor: pointer; cursor: pointer;
display: block; display: block;
float: right; float: right;
font-family: $monserrat; font-family: $montserrat;
font-weight: 700; font-weight: 700;
line-height: $navigation-height; line-height: $navigation-height;
margin: 0; margin: 0;

View file

@ -3,7 +3,7 @@
*/ */
#menu { #menu {
font-family: "Montserrat", sans-serif; font-family: $montserrat;
background-color: $background-primary; background-color: $background-primary;
height: em(60); height: em(60);
max-height: em(60); max-height: em(60);

View file

@ -3,7 +3,7 @@
*/ */
@mixin button($background: $button-primary, $text: $button-text) { @mixin button($background: $button-primary, $text: $button-text) {
font-family: $monserrat; font-family: $montserrat;
font-size: em(16); font-size: em(16);
background-color: $background; background-color: $background;
color: $text; color: $text;

View file

@ -141,6 +141,7 @@ div#categories {
.content { .content {
@include span-columns(9); @include span-columns(9);
@include omega; @include omega;
background: image-url('images/layout/forum-bg-pattern.png') top left;
.text, .text,
.signature { .signature {

View file

@ -0,0 +1,22 @@
/*
Matches Listing
*/
#matches {
table-layout: auto;
margin-bottom: em(20);
.opponent {
width: 30%;
}
.date,
.maps {
width: 20%;
}
.score {
width: 10%;
text-align: right;
}
}

View file

@ -0,0 +1,94 @@
/*
Teams Listing
*/
#teams {
table {
table-layout: auto;
}
.country {
width: 5%;
}
.name {
width: 45%;
}
.irc {
width: 20%;
}
.members {
width: 10%;
}
.actions {
width: 20%;
text-align: right;
}
}
/*
Team Profiles
*/
#team-profile {
.logo {
@include span-columns(12);
margin: em(20) 0;
text-align: center;
img {
display: inline-block;
float: none;
width: auto;
}
}
.controls {
@include span-columns(12);
margin: em(20) 0;
}
}
#members {
table-layout: auto;
.country,
.age {
width: 5%;
}
.member {
width: 20%;
}
.steamid {
width: 15%;
}
.rank {
width: 10%;
}
.note {
width: 30%;
}
.joined {
width: 10%;
}
.joined {
text-align: right;
}
&.short {
.rank {
width: 40%;
}
}
}

View file

@ -0,0 +1,21 @@
#users {
table-layout: auto;
.country,
.age {
width: 5%;
}
.username,
.name {
width: 25%;
}
.steamid {
width: 20%;
}
.actions {
text-align: right;
}
}

View file

@ -7,7 +7,7 @@ class CommentsController < ApplicationController
end end
def show def show
@comments = Comment.recent5.all conditions: {commentable_id: params[:id2], commentable_type: params[:id]} @comments = Comment.recent5.all conditions: { commentable_id: params[:id2], commentable_type: params[:id] }
render partial: 'list', layout: false render partial: 'list', layout: false
end end

View file

@ -8,7 +8,14 @@ class ForumsController < ApplicationController
def show def show
raise AccessError unless @forum.can_show? cuser raise AccessError unless @forum.can_show? cuser
@topics = @forum.topics.all
@topics = Topic.where(forum_id: @forum.id)
.joins(:posts, :user, :users_who_read)
.includes(:lock)
.group('topics.id')
.order('state DESC, posts.id DESC')
.paginate(page: params[:page], per_page: 30)
@forum.read_by! cuser if cuser @forum.read_by! cuser if cuser
@nobody = true @nobody = true
end end

View file

@ -1,76 +1,76 @@
module Extra module Extra
extend ActiveSupport::Concern extend ActiveSupport::Concern
CODING_HTML = 0 CODING_HTML = 0
CODING_BBCODE = 1 CODING_BBCODE = 1
CODING_MARKDOWN = 2 CODING_MARKDOWN = 2
included do included do
def codings def codings
{ {
CODING_HTML => "Plain HTML", CODING_HTML => "Plain HTML",
CODING_BBCODE => "BBCode", CODING_BBCODE => "BBCode",
CODING_MARKDOWN => "Markdown" CODING_MARKDOWN => "Markdown"
} }
end end
def check_params(params, filter) def check_params(params, filter)
(params.instance_of?(Array) ? params : params.keys).each do |key| (params.instance_of?(Array) ? params : params.keys).each do |key|
return false unless filter.include? key.to_sym return false unless filter.include? key.to_sym
end end
return true return true
end end
def error_messages def error_messages
self.errors.full_messages.uniq self.errors.full_messages.uniq
end end
def bbcode_to_html(text) def bbcode_to_html(text)
Sanitize.clean(text.to_s).bbcode_to_html.gsub(/\n|\r\n/, "<br>").html_safe Sanitize.clean(text.to_s).bbcode_to_html.gsub(/\n|\r\n/, "<br>").html_safe
end end
def move_up(scope, column = "position") def move_up(scope, column = "position")
n = 0 n = 0
objects = self.class.all(conditions: scope, order: column) objects = self.class.all(conditions: scope, order: column)
binding.pry binding.pry
objects.each do |item| objects.each do |item|
if item.id == id and n > 0 if item.id == id and n > 0
old_position = item.read_attribute(:column) old_position = item.read_attribute(:column)
item.update_attribute(column, objects.fetch(n-1).read_attribute(:column)) item.update_attribute(column, objects.fetch(n-1).read_attribute(:column))
objects.fetch(n-1).update_attribute(column, old_position) objects.fetch(n-1).update_attribute(column, old_position)
end end
n = n + 1 n = n + 1
end end
end end
def move_down(scope, column = "position") def move_down(scope, column = "position")
n = 0 n = 0
objects = self.class.all(conditions: scope, order: column) objects = self.class.all(conditions: scope, order: column)
binding.pry binding.pry
objects.each do |item| objects.each do |item|
if item.id == id and n < (objects.length-1) if item.id == id and n < (objects.length-1)
old_position = item.read_attribute(:column) old_position = item.read_attribute(:column)
item.update_attribute(column, objects.fetch(n+1).read_attribute(:column)) item.update_attribute(column, objects.fetch(n+1).read_attribute(:column))
objects.fetch(n+1).update_attribute(column, old_position) objects.fetch(n+1).update_attribute(column, old_position)
end end
n = n + 1 n = n + 1
end end
end end
def can_show? cuser def can_show? cuser
true true
end end
def can_create? cuser def can_create? cuser
true true
end end
def can_update? cuser def can_update? cuser
true true
end end
def can_destroy? cuser def can_destroy? cuser
true true
end end
end end
end end

View file

@ -57,7 +57,23 @@ class Topic < ActiveRecord::Base
end end
def view_count def view_count
self.view_counts.length view_counts.length
end
def cache_key(key)
"/topics/#{id}/#{key}"
end
def cached_view_count
Rails.cache.fetch(cache_key('view_count'), expires_in: 24.hours) do
view_count
end
end
def cached_posts_count
Rails.cache.fetch(cache_key('posts'), expires_in: 12.hours) do
posts.count - 1
end
end end
def make_post def make_post

View file

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

View file

@ -34,7 +34,7 @@
</nav> </nav>
<div class="wrapper banner"> <div class="wrapper banner">
<div id="logo"> <div id="logo">
<%= image_tag "logo.png" %> <%= link_to image_tag("logo.png"), root_path %>
</div> </div>
<div id="authentication"> <div id="authentication">
<% if cuser %> <% if cuser %>

View file

@ -6,6 +6,8 @@
<h2><%=h @forum.title %></h2> <h2><%=h @forum.title %></h2>
<%= will_paginate @topics %>
<table id="topics"> <table id="topics">
<tr> <tr>
<th class="topic">Topic</th> <th class="topic">Topic</th>
@ -14,7 +16,7 @@
<th class="views">Views</th> <th class="views">Views</th>
<th class="last">Last Post</th> <th class="last">Last Post</th>
</tr> </tr>
<% @forum.topics.basic.ordered.each do |topic| %> <% @topics.each do |topic| %>
<tr> <tr>
<td> <td>
<h5> <h5>
@ -36,8 +38,8 @@
<% end %> <% end %>
</td> </td>
<td><%= namelink(topic.user) %></td> <td><%= namelink(topic.user) %></td>
<td><%=h topic.posts.count-1 %></td> <td><%=h topic.cached_posts_count %></td>
<td><%=h topic.view_count %></td> <td><%=h topic.cached_view_count %></td>
<td> <td>
<%= link_to lastpost(topic) do %> <%= link_to lastpost(topic) do %>
<%=h topic.posts.last.user %><br> <%=h topic.posts.last.user %><br>
@ -48,4 +50,6 @@
<% end %> <% end %>
</table> </table>
<%= will_paginate @topics %>
<%= render partial: 'controls', locals: { forum: @forum } %> <%= render partial: 'controls', locals: { forum: @forum } %>

View file

@ -1,18 +1,18 @@
<table class="data"> <table id="matches" class="<%= 'contest' if contest %>">
<tr> <tr>
<% if contest %> <% if contest %>
<th width="20%">Contest</th> <th class="contest">Contest</th>
<th width="20%">Opponent</th> <th class="opponent">Opponent</th>
<% else %> <% else %>
<th width="30%">Opponent</th> <th class="opponent">Opponent</th>
<% end %> <% end %>
<th width="20%">Date</th> <th class="date">Date</th>
<% unless defined? exclude_maps %> <% unless defined? exclude_maps %>
<th width="20%">Maps</th> <th class="maps">Maps</th>
<% end %> <% end %>
<th width="5%">Score</th> <th class="score">Score</th>
<% if matches.first and matches.first.contest.contest_type == Contest::TYPE_LADDER %> <% if matches.first and matches.first.contest.contest_type == Contest::TYPE_LADDER %>
<th width="5%">Points</th> <th class="points">Points</th>
<% end %> <% end %>
</tr> </tr>
@ -35,21 +35,21 @@
<%= match.map1 %>, <%= match.map2 %> <%= match.map1 %>, <%= match.map2 %>
</td> </td>
<% end %> <% end %>
<td> <td class="score">
<%= link_to match, :class => "bold #{match.score_color}" do %> <%= link_to match, :class => "bold #{match.score_color}" do %>
<% if friendly == match.contester1.team %> <% if friendly == match.contester1.team %>
<%= h match.score1 %> - <%= h match.score2 %> <%=h match.score1 %> - <%=h match.score2 %>
<% else %> <% else %>
<%= h match.score2 %> - <%= h match.score1 %> <%=h match.score2 %> - <%=h match.score1 %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>
<% if match.contest.contest_type == Contest::TYPE_LADDER %> <% if match.contest.contest_type == Contest::TYPE_LADDER %>
<td> <td>
<% if match.get_friendly(:points) > 0 %> <% if match.get_friendly(:points) > 0 %>
<%= image_tag "icons/up.gif" %> <%= icon 'chevron-up' %>
<% elsif match.get_friendly(:points) < 0 %> <% elsif match.get_friendly(:points) < 0 %>
<%= image_tag "icons/down.gif" %> <%= icon 'chevron-down' %>
<% end %> <% end %>
<%= match.get_friendly(:points) %> <%= match.get_friendly(:points) %>
</td> </td>

View file

@ -9,10 +9,17 @@
</div> </div>
<% if post.user.team %> <% if post.user.team %>
<%= namelink post.user.team %> <strong><%= namelink post.user.team %></strong>
<% end %> <% end %>
<%= cascade post.user, [["Posts", "posts.count"], "from", "joined"] %> <dl>
<dt>Posts</dt>
<dd><%= post.user.posts.count %></dd>
<dt>Location</dt>
<dd><%= post.user.from %></dd>
<dt>Joined</dt>
<dd><%= post.user.joined %></dd>
</dl>
</div> </div>
<div class="content"> <div class="content">

View file

@ -1,38 +1,30 @@
<table class="data"> <table id="members" class="<%= 'short' if !comment %>">
<tr> <tr>
<th>&nbsp;</th> <th class="country"></th>
<th>Member</th> <th class="member">Member</th>
<% if cuser %> <th class="steamid">SteamID</th>
<th>Name</th> <th class="rank">Rank</th>
<% end %>
<th>Age</th>
<th>SteamID</th>
<th>Rank</th>
<% if comment %> <% if comment %>
<th>Comment</th> <th class="note">Comment</th>
<% end %> <% end %>
<th>Joined</th> <th class="joined">Joined</th>
</tr> </tr>
<% teamers.each do |member| %> <% teamers.each do |member| %>
<% next if blacklist and blacklist.exists? :user_id => member.user_id %> <% next if blacklist and blacklist.exists? user_id: member.user_id %>
<% next if member.user.nil? %> <% next if member.user.nil? %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= flag member.user.country %></td> <td><%= flag member.user.country %></td>
<td><%= namelink member.user %></td> <td><%= namelink member.user %></td>
<% if cuser %> <td><%=h member.user.steamid %></td>
<td><%= h member.user.realname %></td>
<% end %>
<td><%= h member.user.age %></td>
<td><%= h member.user.steamid %></td>
<% if member.rank == Teamer::RANK_REMOVED %> <% if member.rank == Teamer::RANK_REMOVED %>
<td>Ex-Member</td> <td>Ex-Member</td>
<% else %> <% else %>
<td><%= member.ranks[member.rank] %></td> <td><%= member.ranks[member.rank] %></td>
<% end %> <% end %>
<% if comment %> <% if comment %>
<td><%= h member.comment %></td> <td><%=h member.comment %></td>
<% end %> <% end %>
<td><%= shortdate member.created_at %></td> <td class="joined"><%= shortdate member.created_at %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View file

@ -1,28 +1,34 @@
<table class="data"> <table>
<tr> <tr>
<th></th> <th class="country"></th>
<th>Name</th> <th class="name">Name</th>
<th>Irc</th> <th class="irc">IRC</th>
<th>Members</th> <th class="members">Members</th>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<th>Options</th> <th class="actions"></th>
<% end %> <% end %>
</tr> </tr>
<% for team in teams %> <% for team in teams %>
<% if team.teamers_num > 0 %> <% if team.teamers_num > 0 %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= flag team.country %></td> <td><%= flag team.country %></td>
<td><%= namelink team %></td> <td><%= namelink team %></td>
<td><%= h team.irc[0,15] if team.irc %></td> <td><%= h team.irc if team.irc %></td>
<td><%= h team.teamers_num %></td> <td><%= h team.teamers_num %></td>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<td> <td class="actions">
<%= link_to 'Edit', edit_team_path(team) %> <%= link_to edit_team_path(team) do %>
<%= icon 'pencil' %> Edit
<% end %>
<% if team.active %> <% if team.active %>
<%= link_to 'Destroy', team, :confirm => 'Are you sure?', :method => :delete %> <%= link_to team, confirm: 'Are you sure?', method: :delete do %>
<%= icon 'times' %> Delete
<% end %>
<% else %> <% else %>
<%= link_to 'Recover', :action => "recover", :id => team %> <%= link_to action: "recover", id: team do %>
<%= icon 'save' %>
<% end %>
<% end %> <% end %>
</td> </td>
<% end %> <% end %>

View file

@ -1,9 +1,10 @@
<h1>Listing teams</h1> <h4>Teams with 0 members are not displayed.</h4> <h1>Listing teams</h1>
<p>Teams with no current members are not displayed.</p>
<div id="box"> <div id="teams">
<%= render :partial => "list", :locals => {:teams => @teams} %> <%= render partial: 'list', locals: { teams: @teams } %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var tabber1 = new Yetii({id: 'teamsTab'}); new Yetii({id: 'teamsTab'});
</script> </script>

View file

@ -1,108 +1,89 @@
<h1 class="center"> <div id="team-profile">
<%= h @team.name %> <h1 class="fancy">
</h1> <span><%=h @team.name %></span>
</h1>
<% if @team.logo %> <% if @team.logo %>
<%= image_tag @team.logo.url, :class => "centered" %> <div class="logo">
<% end %> <%= image_tag @team.logo.url, class: 'logo' %>
<br />
<div id="teamTab">
<ul id="teamTab-nav" class="tabs">
<li><a href="#general">General</a></li>
<li><a href="#members">Members</a></li>
<li><a href="#matches">Matches</a></li>
<li><a href="#statistics">Statistics</a></li>
</ul>
<div class="box wide tabs">
<div class="tab" id="general">
<table class="split">
<tr>
<th>Irc:</th>
<td><%= h @team.irc %></td>
</tr>
<tr>
<th>Web:</th>
<td><%= h @team.web %></td>
</tr>
<tr>
<th>Tag:</th>
<td><%= h @team.tag %></td>
</tr>
<tr>
<th>Country:</th>
<td><%= h @team.country %></td>
</tr>
<tr>
<th>Founder:</th>
<td><%= namelink @team.founder %></td>
</tr>
<tr>
<th>Comment:</th>
<td><%= h @team.comment %></td>
</tr>
<% if @team.recruiting %>
<tr>
<th>Recruiting:</th>
<td><%= h @team.recruiting %></td>
</tr>
<% end %>
</table>
<p class="center">
<%= link_to "Send a message", :controller => "messages", :action => "new", :id => "Team", :id2 => @team %>
</p>
</div> </div>
<% end %>
<div class="tab" id="members"> <div id="team" class="tabbed">
<h3 class="center"> <ul id="team-nav" class="tabs">
Current Members <li><a href="#general">General</a></li>
</h3> <li><a href="#members">Members</a></li>
<li><a href="#matches">Matches</a></li>
<li><a href="#statistics">Statistics</a></li>
</ul>
<%= render :partial => "teamers/list", :locals => {:teamers => @team.teamers.active.ordered.distinct, :blacklist => false, :comment => true } %> <div class="tabbed-contents">
<div class="tab" id="general">
<dl>
<dt>Irc:</dt>
<dd><%= h @team.irc %></dd>
<dt>Web:</dt>
<dd><%= h @team.web %></dd>
<dt>Tag:</dt>
<dd><%= h @team.tag %></dd>
<dt>Country:</dt>
<dd><%= h @team.country %></dd>
<dt>Founder:</dt>
<dd><%= namelink @team.founder %></dd>
<dt>Comment:</dt>
<dd><%= h @team.comment %></dd>
<% if @team.recruiting %>
<dt>Recruiting:</dt>
<dd><%= h @team.recruiting %></dd>
<% end %>
</dl>
<h3 class="center"> <%= link_to "Send a message", { controller: "messages", action: "new", id: "Team", id2: @team }, { class: 'button tiny' } %>
Past Members </div>
</h3>
<%= render :partial => "teamers/list", :locals => {:teamers => @team.teamers.past.distinct, :blacklist => @team.teamers.active.ordered.distinct, :comment => false} %> <div class="tab" id="members">
</div> <h3>Current Members</h3>
<%= render partial: "teamers/list", locals: { teamers: @team.teamers.active.ordered.distinct, blacklist: false, comment: true } %>
<div class="tab" id="matches"> <h3>Past Members</h3>
<% @team.contesters.chronological.each do |contester| %> <%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %>
<% next if Match.finished.ordered.of_contester(contester).count == 0 %> </div>
<h3>
<%= link_to contester.contest, contester.contest, :name => "contest_#{contester.contest.id}" %>
</h3>
<%= render :partial => "matches/list", <div class="tab" id="matches">
:locals => {:matches => Match.finished.ordered.of_contester(contester), :friendly => contester.team, :contest => false} %> <% @team.contesters.chronological.each do |contester| %>
<% end %> <% next if Match.finished.ordered.of_contester(contester).count == 0 %>
</div> <h3>
<%= link_to contester.contest, contester.contest, :name => "contest_#{contester.contest.id}" %>
</h3>
<%= render partial: "matches/list", locals: { matches: Match.finished.ordered.of_contester(contester), friendly: contester.team, contest: false } %>
<% end %>
</div>
<div class="tab" id="matches"> <div class="tab" id="matches">
<p> <dl>
<b>Matches:</b> <%= @team.matches_finished.count %> played / <%= @team.matches.count %> total<br /> <dt>Matches:</dt>
- <b>Won:</b> <%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %) <br /> <dd><%= @team.matches_finished.count %> dllayed / <%= @team.matches.count %> total</dd>
- <b>Lost:</b> <%= @team.matches_lost.count %> (<%= 100.0*@team.matches_lost.count/@team.matches_finished.count %> %) <br /> <dt>Won:</dt>
- <b>Draw:</b> <%= @team.matches_draw.count %> (<%= 100.0*@team.matches_draw.count/@team.matches_finished.count %> %) <br /> <dd><%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %)</dd>
</p> <dt>Lost:</dt>
<dd><%= @team.matches_lost.count %> (<%= 100.0*@team.matches_lost.count/@team.matches_finished.count %> %)</dd>
<dt>Draw:</dt>
<dd><%= @team.matches_draw.count %> (<%= 100.0*@team.matches_draw.count/@team.matches_finished.count %> %)</dd>
</dl>
</div>
</div> </div>
</div> </div>
<script type="text/javascript">
new Yetii({
id: 'team',
active: 2
});
</script>
<% if cuser and @team.can_update? cuser %>
<div class="controls">
<%= link_to 'Edit Team', edit_team_path(@team), class: 'button' %>
</div>
<% end %>
</div> </div>
<script type="text/javascript">
var tabber1 = new Yetii({id: 'teamTab', active: 2});
</script>
<% if cuser and @team.can_update? cuser %>
<%= link_to 'Edit', edit_team_path(@team) %>
<% end %>

View file

@ -22,9 +22,13 @@
<% end %> <% end %>
<% if @newpost.errors.count > 0 %> <% if @newpost.errors.count > 0 %>
<% @newpost.error_messages.each do |m| %> <div class="flash warning">
<%= h m %><br> <ul>
<% end %> <% @newpost.error_messages.each do |m| %>
<li><%= h m %></li>
<% end %>
</ul>
</div>
<% end %> <% end %>
</div> </div>
@ -46,7 +50,7 @@
<%= will_paginate @posts %> <%= will_paginate @posts %>
<div class="right minitext"> <div>
<% if @newpost.can_create? cuser %> <% if @newpost.can_create? cuser %>
<%= link_to_function 'Fast Reply', "$('#reply').fadeIn('slow')", class: 'button' %> <%= link_to_function 'Fast Reply', "$('#reply').fadeIn('slow')", class: 'button' %>
<%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %> <%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %>

View file

@ -2,8 +2,8 @@
<%= form_for @user, :html => { :multipart => true } do |f| %> <%= form_for @user, :html => { :multipart => true } do |f| %>
<% f.fields_for :profile do |p| %> <% f.fields_for :profile do |p| %>
<div id="userTab"> <div id="user" class="tabbed">
<ul id="userTab-nav" class="tabs"> <ul id="user-nav" class="tabs">
<li><a href="#userTabGeneral">General</a></li> <li><a href="#userTabGeneral">General</a></li>
<li><a href="#userTabContact">Contact</a></li> <li><a href="#userTabContact">Contact</a></li>
<li><a href="#userTabCountry"><%= t('profile.locals') %></a></li> <li><a href="#userTabCountry"><%= t('profile.locals') %></a></li>
@ -14,7 +14,7 @@
<li><a href="#notifications">Notify</a></li> <li><a href="#notifications">Notify</a></li>
</ul> </ul>
<div class="box wide tabs"> <div class="tabbed-contents">
<div class="tab" id="userTabGeneral"> <div class="tab" id="userTabGeneral">
<% if @user.errors.any? %> <% if @user.errors.any? %>
<div id="error_explanation"> <div id="error_explanation">
@ -286,5 +286,7 @@
<% end %> <% end %>
<script type="text/javascript"> <script type="text/javascript">
var tabber1 = new Yetii({id: 'userTab'}); new Yetii({
id: 'user'
});
</script> </script>

View file

@ -1,55 +1,47 @@
<h1>Listing users</h1> <h1>Listing Users</h1>
<%= form_tag users_path, :method => 'get' do %> <%= form_tag(users_path, method: 'get', class: 'square search') do %>
<%= hidden_field_tag :direction, params[:direction] %> <%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %> <%= hidden_field_tag :sort, params[:sort] %>
<p> <div class="fields query">
<%= text_field_tag :search, params[:search] %> <%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %> </div>
</p> <div class="controls">
<%= submit_tag "Search", name: nil %>
</div>
<% end %> <% end %>
<table id="usersTable" class="data"> <table id="users">
<tr> <tr>
<th> <th class="country"></th>
Country <th class="username">Username</th>
</th> <th class="name">Name</th>
<th> <th class="steamid">Steam ID</th>
Username <th class="age">Age</th>
</th>
<th>
Real name
</th>
<th>
Steam ID
</th>
<th>
Age
</th>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<th> <th class="actions"></th>
Options
</th>
<% end %> <% end %>
</tr> </tr>
<% @users.each do |user| %> <% @users.each do |user| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= flag user.country %></td> <td><%= flag user.country %></td>
<td><%= link_to (h user.username), user %></td> <td><%= link_to (h user.username), user %></td>
<td><%= h user.firstname %> <%=h user.lastname %></td> <td><%= h user.firstname %> <%=h user.lastname %></td>
<td><%= h user.steamid %></td> <td><%= h user.steamid %></td>
<td><%= user.age %></td> <td><%= user.age %></td>
<% if cuser and cuser.admin? %> <% if cuser and cuser.admin? %>
<td> <td class="actions">
<%= link_to 'Edit', edit_user_path(user) %> <%= link_to edit_user_path(user) do %>
<%= link_to 'Delete', user, :confirm => "Proceed to delete?", :method => :delete %> <%= icon 'pencil' %> Edit
<% end %>
<%= link_to user, confirm: "Proceed to delete?", method: :delete do %>
<%= icon 'times' %> Delete
<% end %>
</td> </td>
<% end %> <% end %>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<p> <%= will_paginate @users %>
<%= will_paginate @users %>
</p>

View file

@ -12,12 +12,11 @@ module Ensl
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += Dir["#{config.root}/app/services/**/", "#{config.root}/app/models/concerns/"] config.autoload_paths += Dir["#{config.root}/app/services/**/", "#{config.root}/app/models/concerns/"]
# Only load the plugins named here, in the order given (default is alphabetical). # Load secrets from .env
# :all can be used as a placeholder for all plugins nowt explicitly named. config.secret_token = ENV['APP_SECRET']
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running. # Use cookies
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer config.session_store :cookie_store, :key => '_ENSL_session_key', :expire_after => 30.days.to_i
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.

View file

@ -1,4 +1,4 @@
set :branch, 'develop' set :branch, 'feature-redesign'
set :deploy_to, '/var/www/virtual/ensl.org/staging/rails' set :deploy_to, '/var/www/virtual/ensl.org/staging/rails'
set :rails_env, 'staging' set :rails_env, 'staging'

View file

@ -27,4 +27,10 @@ Ensl::Application.configure do
# Expands the lines which load the assets # Expands the lines which load the assets
config.assets.debug = true config.assets.debug = true
# Use a different cache store
config.cache_store = :dalli_store
# Enable threaded mode
config.threadsafe!
end end

View file

@ -53,7 +53,7 @@ Ensl::Application.configure do
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true
# Enable threaded mode # Enable threaded mode
# config.threadsafe! config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found) # the I18n.default_locale when a translation can not be found)

View file

@ -53,7 +53,7 @@ Ensl::Application.configure do
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true
# Enable threaded mode # Enable threaded mode
# config.threadsafe! config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found) # the I18n.default_locale when a translation can not be found)

View file

@ -11,14 +11,14 @@ Ensl::Application.configure do
config.whiny_nils = true config.whiny_nils = true
# Show full error reports and disable caching # Show full error reports and disable caching
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates # Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment # Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
@ -32,4 +32,7 @@ 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

@ -1,11 +0,0 @@
module ActionDispatch
class Cookies
class SignedCookieJar
def initialize(parent_jar, secret)
ensure_secret_secure(secret)
@parent_jar = parent_jar
@verifier = MessageVerifier.new(secret,:serializer=>YAML)
end
end
end
end

View file

@ -1 +0,0 @@
Ensl::Application.config.secret_token = ENV['APP_SECRET']

View file

@ -1,4 +0,0 @@
Ensl::Application.config.session_store :active_record_store,
:key => '_ENSL_session_key',
:expire_after => 30.days.to_i