Browse files

Share a _user partial view.

  • Loading branch information...
1 parent 4584550 commit ff2fe3fb8e93fd24cde7f8a801ed9cd20ae69c98 @dgraham committed Jun 24, 2012
View
5 app/templates/followers/index.mustache
@@ -1,9 +1,6 @@
<h2>{{ user_id }}'s {{ pluralized_followers }}</h2>
<ul>
{{#followers}}
- <li>
- {{ user.name }} {{ link_to_user }}
- <p>{{ user.bio }}</p>
- </li>
+ {{> users/user }}
{{/followers}}
</ul>
View
5 app/templates/following/index.mustache
@@ -1,9 +1,6 @@
<h2>{{ user_id }} follows {{ pluralized_following }}</h2>
<ul>
{{#following}}
- <li>
- {{ user.name }} {{ link_to_user }}
- <p>{{ user.bio }}</p>
- </li>
+ {{> users/user }}
{{/following}}
</ul>
View
10 app/templates/users/_user.mustache
@@ -0,0 +1,10 @@
+<li class="user">
+ <header>
+ <a href="{{ url }}">
+ <img class="avatar" src="{{ gravatar }}" alt="{{ name }}"/>
+ <strong class="fullname">{{ name }}</strong>
+ <span class="username">@{{ id }}</span>
+ </a>
+ </header>
+ <p class="bio">{{ bio }}</p>
+</li>
View
9 app/views/followers/index.rb
@@ -12,8 +12,13 @@ def pluralized_followers
def followers
user.followers.map do |follower|
- link = link_to("@#{follower.id}", user_path(follower.id))
- {user: follower, link_to_user: link}
+ {
+ id: follower.id,
+ name: follower.name,
+ bio: follower.bio,
+ url: user_path(follower.id),
+ gravatar: gravatar_for(follower.email)
+ }
end
end
end
View
9 app/views/following/index.rb
@@ -13,8 +13,13 @@ def pluralized_following
def following
user.following.map do |user|
- link = link_to("@#{user.id}", user_path(user.id))
- {user: user, link_to_user: link}
+ {
+ id: user.id,
+ name: user.name,
+ bio: user.bio,
+ url: user_path(user.id),
+ gravatar: gravatar_for(user.email)
+ }
end
end
end

0 comments on commit ff2fe3f

Please sign in to comment.