Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/0.1.6'

Conflicts:
	public/google3075cb0ea738c01d.html
  • Loading branch information...
commit 62da7d020925dbf427fc47a583793b187e377470 2 parents 9658d72 + 0255b25
@jeffkreeftmeijer jeffkreeftmeijer authored
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm use 1.9.2@codebrawl --create
View
3  Gemfile
@@ -1,6 +1,6 @@
source 'http://rubygems.org'
-gem 'rails', '3.1.0.rc1' # :git => 'git://github.com/rails/rails.git'
+gem 'rails', '3.1.0.rc4' # :git => 'git://github.com/rails/rails.git'
gem 'thin'
@@ -29,6 +29,7 @@ gem 'hoptoad_notifier'
group :test do
gem 'rspec-rails'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git', :ref => '549e6733'
+ gem 'launchy'
gem 'mocha'
View
71 Gemfile.lock
@@ -23,35 +23,35 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.7)
- actionmailer (3.1.0.rc1)
- actionpack (= 3.1.0.rc1)
+ actionmailer (3.1.0.rc4)
+ actionpack (= 3.1.0.rc4)
mail (~> 2.3.0)
- actionpack (3.1.0.rc1)
- activemodel (= 3.1.0.rc1)
- activesupport (= 3.1.0.rc1)
+ actionpack (3.1.0.rc4)
+ activemodel (= 3.1.0.rc4)
+ activesupport (= 3.1.0.rc4)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.6.0beta1)
- rack (~> 1.3.0.beta2)
+ i18n (~> 0.6)
+ rack (~> 1.3.0)
rack-cache (~> 1.0.1)
rack-mount (~> 0.8.1)
rack-test (~> 0.6.0)
- sprockets (~> 2.0.0.beta.5)
+ sprockets (~> 2.0.0.beta.10)
tzinfo (~> 0.3.27)
- activemodel (3.1.0.rc1)
- activesupport (= 3.1.0.rc1)
+ activemodel (3.1.0.rc4)
+ activesupport (= 3.1.0.rc4)
bcrypt-ruby (~> 2.1.4)
builder (~> 3.0.0)
- i18n (~> 0.6.0beta1)
- activerecord (3.1.0.rc1)
- activemodel (= 3.1.0.rc1)
- activesupport (= 3.1.0.rc1)
+ i18n (~> 0.6)
+ activerecord (3.1.0.rc4)
+ activemodel (= 3.1.0.rc4)
+ activesupport (= 3.1.0.rc4)
arel (~> 2.1.1)
tzinfo (~> 0.3.27)
- activeresource (3.1.0.rc1)
- activemodel (= 3.1.0.rc1)
- activesupport (= 3.1.0.rc1)
- activesupport (3.1.0.rc1)
+ activeresource (3.1.0.rc4)
+ activemodel (= 3.1.0.rc4)
+ activesupport (= 3.1.0.rc4)
+ activesupport (3.1.0.rc4)
multi_json (~> 1.0)
addressable (2.2.4)
arel (2.1.1)
@@ -66,6 +66,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.1.1)
+ configuration (1.3.1)
daemons (1.1.3)
database_cleaner (0.6.4)
diff-lcs (1.1.2)
@@ -87,7 +88,7 @@ GEM
ruby-progressbar (~> 0.0.10)
gravtastic (3.1.0)
haml (3.1.2)
- hike (1.0.0)
+ hike (1.1.0)
hoptoad_notifier (2.4.11)
activesupport
builder
@@ -98,6 +99,9 @@ GEM
json (1.5.1)
json_pure (1.5.1)
kramdown (0.13.3)
+ launchy (0.4.0)
+ configuration (>= 0.0.5)
+ rake (>= 0.8.1)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -172,21 +176,23 @@ GEM
rack
rack-test (0.6.0)
rack (>= 1.0)
- rails (3.1.0.rc1)
- actionmailer (= 3.1.0.rc1)
- actionpack (= 3.1.0.rc1)
- activerecord (= 3.1.0.rc1)
- activeresource (= 3.1.0.rc1)
- activesupport (= 3.1.0.rc1)
+ rails (3.1.0.rc4)
+ actionmailer (= 3.1.0.rc4)
+ actionpack (= 3.1.0.rc4)
+ activerecord (= 3.1.0.rc4)
+ activeresource (= 3.1.0.rc4)
+ activesupport (= 3.1.0.rc4)
bundler (~> 1.0)
- railties (= 3.1.0.rc1)
- railties (3.1.0.rc1)
- actionpack (= 3.1.0.rc1)
- activesupport (= 3.1.0.rc1)
+ railties (= 3.1.0.rc4)
+ railties (3.1.0.rc4)
+ actionpack (= 3.1.0.rc4)
+ activesupport (= 3.1.0.rc4)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
+ rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
+ rdoc (3.6.1)
rest-client (1.6.1)
mime-types (>= 1.16)
rpm_contrib (1.0.13)
@@ -214,7 +220,7 @@ GEM
blankslate (>= 2.1.2.3)
ffi (~> 1.0.7)
rubyzip (0.9.4)
- sass (3.1.1)
+ sass (3.1.3)
selenium-webdriver (0.2.0)
childprocess (>= 0.1.7)
ffi (>= 1.0.7)
@@ -235,7 +241,7 @@ GEM
timecop (0.3.5)
treetop (1.4.9)
polyglot (>= 0.3.1)
- tzinfo (0.3.27)
+ tzinfo (0.3.28)
uglifier (0.5.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
@@ -263,11 +269,12 @@ DEPENDENCIES
jquery-rails
json
kramdown
+ launchy
mocha
mongoid (~> 2.0)
mongoid_slug
omniauth
- rails (= 3.1.0.rc1)
+ rails (= 3.1.0.rc4)
rpm_contrib
rspec-rails
sass
View
18 app/assets/stylesheets/sass/application.sass.erb
@@ -50,6 +50,20 @@ img.gravatar
border: 1px solid #ddd
vertical-align: middle
+#profile
+ margin-top: 10px
+
+ img
+ width: 220px
+ margin: 0 20px 20px 0
+ float: left
+
+ @media screen and (max-width: 460px)
+ width: 100%
+
+ h3
+ margin: 10px 0
+
p
margin: 10px 0
@@ -94,7 +108,7 @@ form
background-position: center
background-repeat: no-repeat
- @media screen and (max-width: 480px)
+ @media screen and (max-width: 460px)
font-size: 10px
h1 a
@@ -106,7 +120,7 @@ form
#wrapper
margin: auto
- max-width: 760px
+ max-width: 680px
#container
background-color: #eee
View
6 app/helpers/application_helper.rb
@@ -4,4 +4,10 @@ def avatar_url
"http://#{request.domain}#{request.local? ? ":#{request.port}" : ''}#{asset_path('avatar.png')}"
end
+ def link_to_profile(user)
+ link_text = image_tag(user.gravatar_url(:size => 20, :default => avatar_url), :class => 'gravatar')
+ link_text << " " << user.login
+ link_to link_text, user_path(user)
+ end
+
end
View
2  app/models/user.rb
@@ -10,4 +10,6 @@ class User
validates :login, :presence => true
has_gravatar
+
+ alias_method :to_param, :login
end
View
3  app/views/entries/_entry.haml
@@ -1,8 +1,7 @@
%li{ :id => dom_id(entry), :class => entry.contest.closed? ? [%w{gold silver bronze}[entry_counter], 'entry'].join(' ') : 'entry' }
- if entry.contest.closed? || @voted_entries.include?(entry)
.owner
- = image_tag entry.user.gravatar_url(:size => 20, :default => avatar_url), :class => 'gravatar'
- = entry.user.login
+ = link_to_profile(entry.user)
- entry.files.each do |name, file|
.filename
View
7 app/views/layouts/application.haml
@@ -22,11 +22,8 @@
#menu
%span
- if current_user
- = image_tag current_user.gravatar_url(:size => 20, :default => avatar_url), :class => 'gravatar'
- //= link_to current_user.login, user_path(current_user.login)
- = current_user.login
- :erb
- (<%= link_to('log out', [:session], :method => :delete)%>)
+ = link_to_profile(current_user)
+ = "(#{link_to('log out', [:session], :method => :delete)})".html_safe
- else
= link_to('log in via Github', '/auth/github')
View
15 app/views/users/show.haml
@@ -1,7 +1,14 @@
%h2= @user.name
-= image_tag @user.gravatar_url(:size => 220, :default => avatar_url)
+#profile
-%ul
- - @contests.reject{ |contest| contest.open? }.each do |contest|
- %li= contest.name
+ = image_tag @user.gravatar_url(:size => 140, :default => avatar_url)
+
+ = link_to("#{@user.login} on Github", "https://github.com/#{@user.login}")
+
+ - if @contests.any?
+ %h3 Contests
+ %ul
+ - @contests.all.each do |contest|
+ %li= link_to contest.name, contest
+ %hr
View
2  config/environments/production.rb
@@ -13,7 +13,7 @@
# Compress both stylesheets and JavaScripts
config.assets.js_compressor = :uglifier
- config.assets.css_compressor = :scss
+ #config.assets.css_compressor = :scss
# Specifies the header that your server uses for sending files
# (comment out if your front-end server doesn't support this)
View
2  public/google3075cb0ea738c01d.html
@@ -1 +1 @@
-google-site-verification: google3075cb0ea738c01d.html
+google-site-verification: google3075cb0ea738c01d.html
View
2  spec/acceptance/acceptance_helper.rb
@@ -12,7 +12,7 @@
'user_info' => {
'nickname' => 'charlie',
'email' => 'charlie@email.com',
- 'name' => 'Charlie'
+ 'name' => 'Charlie Chaplin'
}
}
end
View
4 spec/acceptance/contest_index_spec.rb
@@ -83,9 +83,9 @@
background { login_via_github }
- pending 'visit my profile page' do
+ scenario 'visit my profile page' do
click_link 'charlie'
- page.should have_content 'Alice'
+ page.should have_content 'Charlie Chaplin'
end
end
View
5 spec/acceptance/users_spec.rb
@@ -32,6 +32,11 @@
scenario 'see the user gravatar' do
body.should include 'http://gravatar.com/avatar/1dae832a3c5ae2702f34ed50a40010e8.png'
end
+
+ scenario 'see the link to the users github profile' do
+ page.should have_link 'charlie on Github'
+ body.should include 'https://github.com/charlie'
+ end
scenario 'see the list of entered contests' do
page.should have_content 'RSpec extensions'
View
29 spec/helpers/application_helper_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe ApplicationHelper do
+ describe "link_to_profile" do
+ before :each do
+ @user = stub(:login => 'charlie', :to_param => 'charlie', :gravatar_url => 'http://gravatar.org/profile.png')
+ end
+
+ let(:output) { helper.link_to_profile(@user) }
+
+ it "should include the gravatar image" do
+ output.should include('<img')
+ output.should include('src="http://gravatar.org/profile.png"')
+ end
+
+ it "should include the username" do
+ output.should include("charlie")
+ end
+
+ it "should html escape the username" do
+ @user.stubs(:login => '<script>alert("xss")</script>')
+ output.should_not include('<script>')
+ end
+
+ it "should link to the users profile" do
+ output.should include('href="/users/charlie"')
+ end
+ end
+end
View
6 spec/models/user_spec.rb
@@ -18,4 +18,10 @@
end
+ describe "#to_param" do
+ it "should use the login field" do
+ User.new(:login => 'pete').to_param.should eql('pete')
+ end
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.