Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Commit

Permalink
Add the HubStar toggle to the Repositories#show page
Browse files Browse the repository at this point in the history
  • Loading branch information
rspeicher committed Mar 27, 2012
1 parent 4034ec8 commit 8b6a32c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/custom.css.scss
Expand Up @@ -69,6 +69,10 @@ div.intro {
.forks span {
background-position: 5px -52px;
}

.hubstars p {
margin: 0;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/repositories_controller.rb
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions app/views/repositories/show.html.erb
@@ -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.