Skip to content

Commit

Permalink
Adds rels for user profile links to followers, following, and updates.
Browse files Browse the repository at this point in the history
According to ALPS, the following rels are used on <a> tags:

messages-me: Applied to an A tag. A reference to a list representation
of all the messages posted by the designated user.

users-friends: Applied to an A tag. A reference to list representation
of the designated user's friend users.

users-followers: Applied to an A tag. A reference to list representation
of the users who follow the designated user.
  • Loading branch information
wilkie committed Mar 10, 2013
1 parent 4c88b88 commit 1e4cf45
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/views/shared/sidebar/_profile.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
@#{current_user.username}
%ul.stats
%li.update-count
%a{ :href => "/users/#{current_user.username}" }
%a{ :href => "/users/#{current_user.username}", :rel => 'messages-me' }
.icon
%span.number= current_user.feed.updates.count
Updates
%li.following-count
%a{ :href => "/users/#{current_user.username}/following" }
%a{ :href => "/users/#{current_user.username}/following", :rel => 'users-friends' }
.icon
%span.number= current_user.following.length
Following
%li.follower-count.last
%a{ :href => "/users/#{current_user.username}/followers" }
%a{ :href => "/users/#{current_user.username}/followers", :rel => 'users-followers' }
.icon
%span.number= current_user.followers.length
Followers
6 changes: 3 additions & 3 deletions app/views/users/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@

%ul.stats
%li.update-count
%a{ :href => "#profile_updates" }
%a{ :href => "#profile_updates", :rel => 'messages-me' }
%span.icon
%span.number= @author.feed.updates.count
Updates
%li.following-count
%a{ :href => "/users/#{@author.username}/following" }
%a{ :href => "/users/#{@author.username}/following", :rel => 'users-friends' }
%span.icon
%span.number= @author.user.following.length
Following
%li.follower-count
%a{ :href => "/users/#{@author.username}/followers" }
%a{ :href => "/users/#{@author.username}/followers", :rel => 'users-followers'}
%span.icon
%span.number= @author.user.followers.length
Followers
Expand Down
29 changes: 29 additions & 0 deletions test/acceptance/alps/user_profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,34 @@
end
end

it "has the followers link in a rel=users-followers" do
visit "/users/#{@user.username}"
within "li.user" do
assert has_selector?(
:xpath,
"//a[contains(@rel, 'users-followers') and @href='/users/#{@user.username}/followers']"
)
end
end

it "has the following link in a rel=users-friends" do
visit "/users/#{@user.username}"
within "li.user" do
assert has_selector?(
:xpath,
"//a[contains(@rel, 'users-friends') and @href='/users/#{@user.username}/following']"
)
end
end

it "has the updates link in a rel=messages-me" do
visit "/users/#{@user.username}"
within "li.user" do
assert has_selector?(
:xpath,
"//a[contains(@rel, 'messages-me') and @href='#profile_updates']"
)
end
end
end

0 comments on commit 1e4cf45

Please sign in to comment.