Tests passing with redesign

Improved layout slightly to match grid
This commit is contained in:
Luke Barratt 2014-04-17 08:55:19 +01:00
parent 2a661e83ce
commit 4046d25017
24 changed files with 181 additions and 155 deletions

View file

@ -9,7 +9,7 @@
//= require_self //= require_self
$ -> $ ->
$('logout').click -> $('#logout').click ->
$(this).closest('form').submit() $(this).closest('form').submit()
$('select').each (i, el) -> $('select').each (i, el) ->

View file

@ -2,12 +2,15 @@
Neat Overrides Neat Overrides
*/ */
@import "neat-helpers"; $max-width: em(1200);
$column: 90px; /*
$gutter: 30px; Grid Debugging
$grid-columns: 12; */
$max-width: em(1180);
// $visual-grid: true;
// $visual-grid-index: 10000;
// $visual-grid-opacity: 0.5;
/* /*
Neat Breakpoints Neat Breakpoints

View file

@ -5,6 +5,7 @@
@import "bourbon"; @import "bourbon";
@import "variables"; @import "variables";
@import "neat"; @import "neat";
@import "neat-helpers";
@import "font-awesome"; @import "font-awesome";
/* /*
@ -14,6 +15,18 @@
@import "mixins/buttons"; @import "mixins/buttons";
@import "mixins/flashes"; @import "mixins/flashes";
/*
Layout
*/
@import "layout/body";
@import "layout/typography";
@import "layout/header";
@import "layout/navigation";
@import "layout/sidebar";
@import "layout/footer";
@import "layout/helpers";
/* /*
Components Components
*/ */
@ -29,18 +42,6 @@
@import "components/tabs"; @import "components/tabs";
@import "components/shoutbox"; @import "components/shoutbox";
/*
Layout
*/
@import "layout/typography";
@import "layout/header";
@import "layout/navigation";
@import "layout/body";
@import "layout/sidebar";
@import "layout/footer";
@import "layout/helpers";
/* /*
Pages Pages
*/ */

View file

@ -1,4 +1,4 @@
#comments { #comments-thread {
@include span-columns(12); @include span-columns(12);
h3 { h3 {

View file

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

View file

@ -168,5 +168,5 @@
padding: em(14); padding: em(14);
text-align: center; text-align: center;
margin-left: - em(20); margin-left: - em(20);
width: $max-width; width: $max-width + $container-padding*2;
} }

View file

@ -2,6 +2,8 @@
Main Containers Main Containers
*/ */
$container-padding: em(20);
html, html,
body { body {
margin: 0; margin: 0;
@ -20,22 +22,15 @@ body {
min-height: 100%; min-height: 100%;
} }
%container-padded {
padding: 0 em(20);
}
.wrapper { .wrapper {
@include outer-container; @include outer-container;
} max-width: $max-width + $container-padding*2;
#content {
@extend %container-padded;
} }
#content { #content {
@include span-columns(12); @include span-columns(12);
background: $light-blue; background: $light-blue;
padding-top: em(20); padding: $container-padding $container-padding 0 $container-padding;
} }
#forums { #forums {
@ -43,11 +38,11 @@ body {
} }
#main { #main {
@include span-columns(9); @include span-columns(9 of 12);
} }
#sidebar { #sidebar {
@include span-columns(3); @include span-columns(3 of 12);
@include omega(); @include omega();
} }

View file

@ -6,11 +6,10 @@
@include outer-container; @include outer-container;
background: $footer-background; background: $footer-background;
padding: $base-line-height*2 $gutter; max-width: $max-width + $container-padding*2;
width: 100%;
.wrapper { .content {
@extend %container-padded; padding: $container-padding*2 $container-padding;
} }
.footer-links { .footer-links {
@ -32,7 +31,7 @@
text-align: center; text-align: center;
@include media($medium-screen) { @include media($medium-screen) {
text-align: left; text-align: center;
} }
} }

View file

@ -13,7 +13,6 @@ nav.top {
.menu-wrapper { .menu-wrapper {
@include outer-container; @include outer-container;
@extend %container-padded;
position: relative; position: relative;
z-index: 9999; z-index: 9999;
} }
@ -111,6 +110,8 @@ nav.top {
} }
header .banner { header .banner {
padding: 0 $container-padding;
#logo { #logo {
@include span-columns(8); @include span-columns(8);
min-height: em(200); min-height: em(200);

View file

@ -3,6 +3,7 @@
*/ */
#menu { #menu {
@include span-columns(12);
font-family: $montserrat; font-family: $montserrat;
background-color: $background-primary; background-color: $background-primary;
height: em(60); height: em(60);

View file

@ -71,6 +71,28 @@
#user-data { #user-data {
@include span-columns(12); @include span-columns(12);
margin-bottom: em(20); margin-bottom: em(20);
h2,
h3,
h4 {
margin-bottom: 1em;
}
.group {
@include span-columns(6);
dd a {
float: none;
display: block;
}
}
tbody td {
&:first-child,
&:nth-child(2) {
text-align: left;
}
}
} }
} }

View file

@ -93,10 +93,10 @@ module ApplicationHelper
end end
item << content_tag(:dt) do item << content_tag(:dt) do
"#{name.to_s.capitalize.gsub(/_s/, '').gsub(/_/, ' ')}" "#{name.to_s.capitalize.gsub(/_s/, '').gsub(/_/, ' ')}".html_safe
end end
item << content_tag(:dd) do item << content_tag(:dd) do
result result.html_safe
end end
item item
@ -165,6 +165,10 @@ module ApplicationHelper
end end
def latest_rules def latest_rules
if Contest.last
Contest.last.rules Contest.last.rules
else
article_path(Article::RULES)
end
end end
end end

View file

@ -1,5 +1,5 @@
<footer class="footer"> <footer class="footer">
<div class="wrapper"> <div class="content">
<div class="footer-links"> <div class="footer-links">
<ul> <ul>
<li><h3><%= link_to "Contests", controller: "contests", action: "current" %></h3></li> <li><h3><%= link_to "Contests", controller: "contests", action: "current" %></h3></li>

View file

@ -1,4 +1,4 @@
<div id="comments"> <div id="comments-thread">
<h3>Comments</h3> <h3>Comments</h3>
<%= render partial: "comments/comment", collection: @comments %> <%= render partial: "comments/comment", collection: @comments %>
<%= render partial: "comments/new" %> <%= render partial: "comments/new" %>

View file

@ -1,2 +1,2 @@
$(".comment-form").hide(); $(".comment-form").hide();
$("#comments").append("<%= escape_javascript(render("comment", comment: @comment)) %>"); $("#comments-thread").append("<%= escape_javascript(render("comment", comment: @comment)) %>");

View file

@ -1,8 +0,0 @@
<h2>
Computer
</h2>
<div class="userFields">
<%= cascade @user.profile, ["cpu", "gpu", "ram", "psu", "motherboard", "soundcard", "hdd", "case", "monitor", "mouse"] %>
<%= cascade @user.profile, ["mouse_pad", "keyboard", "head_phones", "res", "sensitivity", "monitor_hz", "scripts"] %>
</div>

View file

@ -1,7 +0,0 @@
<h2>
Favorites
</h2>
<div class="userFields">
<%= cascade @user.profile, ["hobby", "singleplayer", "multiplayer", "food", "beverage", "music", "book", "movie", "tvseries"] %>
</div>

View file

@ -1,87 +1,85 @@
<div class="group"> <div class="group">
<h4>General information</h4> <h4>General information</h4>
<%= cascade @user, ["steamid"] %> <dl>
<%= link_to "http://steamidfinder.com/?STEAM_#{@user.steamid}" do %> <dt>Age</dt>
<small>Search for corresponding Steam account</small> <dd><%= @user.age %></dd>
<dt>Country</dt>
<dd><%= @user.country %></dd>
<dt>Town</dt>
<dd><%= @user.profile.town %></dd>
<dt>SteamID</dt>
<dd>
<%= @user.steamid %>
<%= link_to "Search for Steam Account", "http://steamidfinder.com/?STEAM_#{@user.steamid}" %>
</dd>
</dl>
<h4>Contact</h4>
<dl>
<% if !@user.profile.web.blank? %>
<dt>Web</dt>
<dd><%= @user.profile.web %></dd>
<% end %> <% end %>
<%= cascade @user, ["age"] %>
<%= cascade @user, ["country"] %>
<%= cascade @user.profile, ["town"] %>
</div>
<div class="group">
<h4>Miscellaneous</h4>
<p>
<strong>Joined:</strong> <%= longtime @user.created_at %>
</p>
<p>
<strong>Last visit:</strong> <%= longtime @user.lastvisit %>
</p>
<% if cuser and cuser.admin? %>
<p>
<b>Last ip</b> <%= @user.lastip %>
</p>
<% end %>
<%= cascade @user, [["Comments", "posted_comments.count"], ["Matches", "matches.count"]] %>
<% if @user.groups.count > 0 %>
<p>
<b>Groups:</b>
<% for group in @user.groups.all %>
<%= namelink group %>
<% end %>
</p>
<% end %>
<% if @user.teamers.active.count > 0 %>
<p>
Teams:
<% @user.teamers.active.each do |teamer| %>
<%= namelink teamer.team %>
<% end %>
</p>
<% end %>
</div>
<h3>
Contact
</h3>
<div class="group">
<%= cascade @user.profile, ["web"] %>
<% if cuser and cuser.admin? or @user.public_email %> <% if cuser and cuser.admin? or @user.public_email %>
<%= cascade @user, ["email_s"] %> <dt>Email</dt>
<dd><%= @user.email_s %></dd>
<% end %> <% end %>
<% if @user.profile.steam_profile and @user.profile.steam_profile != "" %> <% if @user.profile.steam_profile and @user.profile.steam_profile != "" %>
<p> <dt>Steam</dt>
<b>Steam:</b> <dd>
<% if @user.profile.steam_profile.match(/\A[0-9]*\z/) %> <% if @user.profile.steam_profile.match(/\A[0-9]*\z/) %>
<%= link_to @user.profile.steam_profile, "http://steamcommunity.com/profiles/#{@user.profile.steam_profile}" %> <%= link_to @user.profile.steam_profile, "http://steamcommunity.com/profiles/#{@user.profile.steam_profile}" %>
<% elsif @user.profile.steam_profile.match(/\A[A-Za-z0-9_\-\+]{1,40}\z/) %> <% elsif @user.profile.steam_profile.match(/\A[A-Za-z0-9_\-\+]{1,40}\z/) %>
<%= link_to @user.profile.steam_profile, "http://steamcommunity.com/id/#{@user.profile.steam_profile}" %> <%= link_to @user.profile.steam_profile, "http://steamcommunity.com/id/#{@user.profile.steam_profile}" %>
<% end %> <% end %>
</p> </dd>
<% end %>
</dl>
<% if @user.profile.achievements and !@user.profile.achievements.empty? %>
<h4>Achievements</h4>
<%= @user.profile.achievements_parsed.html_safe %>
<% end %> <% end %>
<p> <%= link_to "Send PM", { controller: "messages", action: "new", id: "User", id2: @user }, { class: 'button tiny' } %>
<%= link_to "Send PM", :controller => "messages", :action => "new", :id => "User", :id2 => @user %>
</p>
</div> </div>
<% if @user.profile.achievements and !@user.profile.achievements.empty? %> <div class="group">
<h3> <h4>Statistics</h4>
Achievements
</h3>
<div class="group"> <dl>
<%= raw @user.profile.achievements_parsed %> <dt>Joined</dt>
</div> <dd><%= longtime @user.created_at %></dd>
<% end %> <dt>Last visit</dt>
<dd><%= longtime @user.lastvisit %></dd>
<dt></dt>
<% if cuser and cuser.admin? %>
<dt>Last IP</dt>
<dd><%= @user.lastip %></dd>
<% end %>
<dt>Comments</dt>
<dd><%= @user.posted_comments.count %></dd>
<dt>Matches</dt>
<dd><%= @user.matches.count %></dd>
<% if @user.groups.count > 0 %>
<dt>Groups</dt>
<% for group in @user.groups.all %>
<dd><%= namelink group %></dd>
<% end %>
<% end %>
<% if @user.teamers.active.count > 0 %>
<dt>Teams</dt>
<% @user.teamers.active.each do |teamer| %>
<dd><%= namelink teamer.team %></dd>
<% end %>
<% end %>
</dl>
</div>

View file

@ -1,11 +1,6 @@
<h2> <h4>Match History</h4>
Match History
</h2>
<% @user.match_teams.each do |team| %> <% @user.match_teams.each do |team| %>
<h3> <h4><%= namelink team %></h4>
<%= namelink team %> <%= render partial: "matches/list", locals: { matches: Match.finished.ordered.of_userteam(@user, team), friendly: team, contest: true, exclude_maps: true } %>
</h3>
<%= render :partial => "matches/list", :locals => {:matches => Match.finished.ordered.of_userteam(@user, team), :friendly => team, :contest => true, :exclude_maps => true} %>
<% end %> <% end %>

View file

@ -26,8 +26,8 @@
<td class="<%= 'current' if teamer.team == @user.team %>"> <td class="<%= 'current' if teamer.team == @user.team %>">
<%= link_to (h teamer.team.name), teamer.team %> <%= link_to (h teamer.team.name), teamer.team %>
</td> </td>
<td><%= h teamer.comment %></td> <td><%=h teamer.comment %></td>
<td><%= h teamer.ranks[teamer.rank] %></td> <td><%=h teamer.ranks[teamer.rank] %></td>
<td> <td>
<% if @user.team != teamer.team %> <% if @user.team != teamer.team %>
<%= form_for @user do |u| %> <%= form_for @user do |u| %>

View file

@ -70,7 +70,7 @@ feature 'Google Calendar widget' do
private private
def first_event def first_event
page.find(:xpath, "//div[@id = 'index-calendar']/div/div[@class = 'content'][1]") first ".widget.calendar .entry"
end end
def timezone_adjusted def timezone_adjusted

View file

@ -15,7 +15,10 @@ feature 'Case insensitive login' do
click_button submit(:user, :login) click_button submit(:user, :login)
expect(page).to have_content(I18n.t('login_successful')) expect(page).to have_content(I18n.t('login_successful'))
expect(page).to have_content("Logged in as: #{username}")
within user_status do
expect(page).to have_content(username)
end
end end
scenario 'with a non-matching case allows the user to sign in' do scenario 'with a non-matching case allows the user to sign in' do
@ -23,7 +26,10 @@ feature 'Case insensitive login' do
click_button submit(:user, :login) click_button submit(:user, :login)
expect(page).to have_content(I18n.t('login_successful')) expect(page).to have_content(I18n.t('login_successful'))
expect(page).to have_content("Logged in as: #{username}")
within user_status do
expect(page).to have_content(username)
end
end end
end end

View file

@ -8,29 +8,37 @@ feature 'Visitor signs up' do
end end
scenario 'with valid Username, Email, Password and Steam ID' do scenario 'with valid Username, Email, Password and Steam ID' do
within registration_form do
fill_form(:user, user.slice(*sign_up_attributes)) fill_form(:user, user.slice(*sign_up_attributes))
click_button submit(:user, :create) click_button submit(:user, :create)
end
expect(page).to have_content("Logged in as: #{user[:username]}") expect(user_status).to have_content(user[:username])
end end
scenario 'with invalid Email' do scenario 'with invalid Email' do
within registration_form do
fill_form(:user, user.slice(*sign_up_attributes).merge({ email: "invalid" })) fill_form(:user, user.slice(*sign_up_attributes).merge({ email: "invalid" }))
click_button submit(:user, :create) click_button submit(:user, :create)
end
expect(page).to have_content(error_message('email.invalid')) expect(page).to have_content(error_message('email.invalid'))
end end
scenario 'with blank Password' do scenario 'with blank Password' do
within registration_form do
fill_form(:user, user.slice(*sign_up_attributes).merge({ raw_password: "" })) fill_form(:user, user.slice(*sign_up_attributes).merge({ raw_password: "" }))
click_button submit(:user, :create) click_button submit(:user, :create)
end
expect(page).to have_content(error_message('raw_password.blank')) expect(page).to have_content(error_message('raw_password.blank'))
end end
scenario 'with invalid Steam ID' do scenario 'with invalid Steam ID' do
within registration_form do
fill_form(:user, user.slice(*sign_up_attributes).merge({ steamid: "invalid" })) fill_form(:user, user.slice(*sign_up_attributes).merge({ steamid: "invalid" }))
click_button submit(:user, :create) click_button submit(:user, :create)
end
expect(page).to have_content(error_message('steamid.invalid')) expect(page).to have_content(error_message('steamid.invalid'))
end end

View file

@ -17,5 +17,13 @@ module Features
click_button I18n.t('helpers.submit.user.update') click_button I18n.t('helpers.submit.user.update')
end end
def user_status
find "#authentication"
end
def registration_form
find "#new_user"
end
end end
end end