Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fc4a7716e1
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (19 sloc) 0.817 kb
<% if current_user %>
<div style='float:right;'><%= link_to *(params[:sort] == 'social' ? ['Sort Alphabetically', {:sort => nil}] : ['Sort Socially', {:sort => 'social'}])%></div>
<% end %>
<h1>Products<% if params[:sort] == 'social' %> popular with my follows<% end %><% if params[:actor]%> with <%= params[:actor] %><% end %></h1>
<table>
<tbody>
<% @products.each do |product| %>
<tr>
<th><%= link_to image_tag(product.image), product %></th>
<td><%= link_to truncate(raw(product.title), 60), product %></td>
<% if user_signed_in? && !current_user.purchases.find_by_product_id(product.id.to_s) %>
<td><%= button_to 'Purchase', purchase_product_path(product) %></td>
<% else %>
<td/>
<% end %>
</tr>
<% end %>
</tbody>
</table>
Jump to Line
Something went wrong with that request. Please try again.