Skip to content

Commit

Permalink
Add Gravatar images
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyhaines committed Aug 27, 2011
1 parent 8b9177a commit d40366a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
11 changes: 1 addition & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ source 'http://rubygems.org'

gem 'rails', '3.1.0.rc6'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'haml'
gem 'devise'
gem 'gravtastic'


# Gems used only for assets and not required
Expand All @@ -19,14 +17,7 @@ end

gem 'jquery-rails'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
gem 'sqlite3', group: [:development, :test]
group :development do
gem 'heroku'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ GEM
erubis (2.7.0)
execjs (1.2.4)
multi_json (~> 1.0)
gravtastic (3.2.6)
grb (0.4.1)
haml (3.1.2)
heroku (2.4.2)
Expand Down Expand Up @@ -130,6 +131,7 @@ PLATFORMS
DEPENDENCIES
coffee-rails (~> 3.1.0.rc)
devise
gravtastic
grb
haml
heroku
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/pairing_sessions.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-moz-border-radius: 25px;
border-radius: 25px;
display: inline;
height: 100px;
height: 108px;
width: 30%;
text-align: center;
background-color: lightgreen;
Expand Down
4 changes: 4 additions & 0 deletions app/models/pairing_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ class PairingSession < ActiveRecord::Base
def self.with_users
all(:include => [:pair_1, :pair_2], :order => "start")
end

def participants
[pair_1, pair_2]
end
end
5 changes: 4 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
class User < ActiveRecord::Base
has_many :pairing_sessions, :foreign_key => :pair_1_id
include Gravtastic
is_gravtastic secure: false, size: 80, default: "identicon"

devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable

has_many :pairing_sessions, :foreign_key => :pair_1_id
end
9 changes: 6 additions & 3 deletions app/views/pairing_sessions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
</div>
</div>
<ul class='participants box'>
<li><div class='name'><%= session.pair_1.name %></div></li>
<li><div class='name'><%= session.pair_2.name %></div></li>
<% session.participants.each do |participant| %>
<li>
<div class='name'><%= participant.name %></div>
<div class='gravatar'><%= image_tag participant.gravatar_url %></div>
</li>
<% end %>
</ul>
</li>
<% end %>

</ul>
</div>
4 changes: 2 additions & 2 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
User.destroy_all

p1 = User.create email: "coreyhaines@example.com", name: "Corey", password: "password"
p2 = User.create email: "sarahgray@example.com", name: "Sarah", password: "password"
p1 = User.create email: "coreyhaines@gmail.com", name: "Corey", password: "password"
p2 = User.create email: "sarahg.gray@gmail.com", name: "Sarah", password: "password"

PairingSession.destroy_all

Expand Down

0 comments on commit d40366a

Please sign in to comment.