Skip to content

Commit

Permalink
adding User#display_handle, showing email on profile
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Nov 3, 2010
1 parent eede2b6 commit 99344c2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
4 changes: 4 additions & 0 deletions app/models/user.rb
Expand Up @@ -37,6 +37,10 @@ def name
handle || email
end

def display_handle
handle || "##{id}"
end

def rubyforge_importer?
id.to_s == ENV["RUBYFORGE_IMPORTER"]
end
Expand Down
3 changes: 2 additions & 1 deletion app/views/profiles/show.html.erb
Expand Up @@ -3,7 +3,8 @@
<%= gravatar(64, "profile_gravatar", @user) %>
</div>
<div id="profile-info">
<h2 id="profile-name"><%= link_to @user.handle, profile_path(@user) %></h2>
<h2 id="profile-name"><%= link_to @user.display_handle, profile_path(@user) %></h2>
<h3 id="profile-email"><%= link_to @user.email, "mailto:#{@user.email}" %></h2>
</div>
<div id="downloads-ego">
<h5 id="downloads">Downloads</h5>
Expand Down
6 changes: 5 additions & 1 deletion config/initializers/redis.rb
@@ -1 +1,5 @@
$redis = Redis.new
if Rails.env.test? || Rails.env.cucumber?
$redis = Redis.new(:db => 1)
else
$redis = Redis.new(:db => 0)
end
24 changes: 4 additions & 20 deletions public/stylesheets/screen.css
Expand Up @@ -1422,7 +1422,7 @@ form#main-search input[type="submit"] {
}

#downloads-ego {
margin-left: 560px;
margin-left: 575px;
position: absolute;
top: 175px;
}
Expand All @@ -1435,25 +1435,9 @@ h2#profile-name {
display: block;
}

h3#location {
display: block;
color: #32221b;
font-size: 16px;
margin: 5px 0 0 0;
}

h4#website {
display: block;
color: #5e5450;
font-size: 14px;
margin: 5px 0 0 0;
border-bottom: 0;
}

h4#website a {
color: #5e5450;
font-size: 14px;
text-decoration: underline;
h3#profile-email {
font-size: 20px;
margin: 0;
}

#profile-info p {
Expand Down
8 changes: 8 additions & 0 deletions test/unit/user_test.rb
Expand Up @@ -37,6 +37,14 @@ class UserTest < ActiveSupport::TestCase
assert Factory(:user, :handle => nil)
assert Factory(:user, :handle => nil)
end

should "show user id if no handle set" do
user = Factory.build(:user, :handle => nil, :id => 13)
assert_equal "#13", user.display_handle

user.handle = "bills"
assert_equal "bills", user.display_handle
end
end
end

Expand Down
Binary file added vendor/cache/timecop-0.3.5.gem
Binary file not shown.

0 comments on commit 99344c2

Please sign in to comment.