Favorite groups

This commit is contained in:
Toks
2015-06-23 15:25:54 -04:00
parent e1dc51e026
commit 04fa5596e2
27 changed files with 574 additions and 15 deletions

View File

@@ -6,6 +6,7 @@
<li><%= link_to "Hot", posts_path(:tags => "order:rank") %></li>
<% unless CurrentUser.is_anonymous? %>
<li><%= link_to "Favorites", favorites_path %></li>
<li><%= link_to "Favorite groups", favorite_groups_path %></li>
<% if CurrentUser.user.has_saved_searches? %>
<li><%= link_to "Saved searches", saved_searches_path %></li>
<% end %>

View File

@@ -0,0 +1,23 @@
<div id="favgroup-nav">
<ul>
<% post.favorite_groups.each do |favgroup| %>
<li>
<% if favgroup.neighbors(post).previous %>
<%= link_to("&lsaquo;&thinsp;prev".html_safe, post_path(favgroup.neighbors(post).previous), :rel => "prev", :class => "prev") %>
<% else %>
<span class="prev">&lsaquo;&thinsp;prev</span>
<% end %>
<span class="favgroup-name">
<%= link_to("Favorite group: #{favgroup.name}", favorite_group_path(favgroup)) %>
</span>
<% if favgroup.neighbors(post).next %>
<%= link_to("next&thinsp;&rsaquo;".html_safe, post_path(favgroup.neighbors(post).next), :rel => "next", :class => "next") %>
<% else %>
<span class="next">next&thinsp;&rsaquo;</span>
<% end %>
</li>
<% end %>
</ul>
</div>

View File

@@ -7,5 +7,9 @@
<% if post.pools.any? %>
<%= render "posts/partials/show/pools", :post => post %>
<% end %>
<% if post.favorite_groups.any? %>
<%= render "posts/partials/show/favorite_groups", :post => post %>
<% end %>
</div>
<% end %>