Permalink
Browse files

Add the HubStar toggle to the Repositories#show page

  • Loading branch information...
1 parent 4034ec8 commit 8b6a32c2ba239821624c5d5a27d946be2d6efe6d @tsigo committed Mar 27, 2012
@@ -69,6 +69,10 @@ div.intro {
.forks span {
background-position: 5px -52px;
}
+
+ .hubstars p {
+ margin: 0;
+ }
}
}
@@ -11,7 +11,8 @@ def index
end
def show
- @repo = Repository.find_or_initialize_by_name(params[:id])
+ @repo = Repository.find_or_initialize_by_name(params[:id])
+ @users = @repo.users_with_priority_to(current_user)
respond_to do |wants|
wants.html
@@ -1,13 +1,21 @@
<h2>Users who starred <%= link_to(@repo.to_s, @repo.link) %></h2>
-<% @repo.users.each do |user| %>
+<% @users.each do |user| %>
<div class="row user-info">
<div class="span1 user-avatar"><%= image_tag(user.avatar_url, size: '48x48') %></div>
- <div class="span11">
+ <div class="span9">
<h3><%= link_to(user.username, user.html_url) %></h3>
<span class="description">
<%= user.name %>
</span>
</div>
+ <div class="span2 repo-stats">
+ <%- if user == current_user %>
+ <div class="hubstars hubstarred">
+ <p class="hint">Toggle HubStar:</p>
+ <%= link_to(@repo.stars, repository_path(@repo), class: 'toggle', data: {id: @repo.name}) %>
+ </div>
+ <%- end %>
+ </div>
</div>
<% end %>

0 comments on commit 8b6a32c

Please sign in to comment.