Allow A/D shortcuts for browsing favgroups

This commit is contained in:
Toks
2015-06-25 10:29:59 -04:00
parent 04fa5596e2
commit c2530e9e53
3 changed files with 8 additions and 6 deletions

View File

@@ -148,7 +148,7 @@
location.href = href; location.href = href;
} }
} else { } else {
var href = $("#pool-nav a.active[rel=prev]").attr("href"); var href = $("#pool-nav a.active[rel=prev], #favgroup-nav a.active[rel=prev]").attr("href");
if (href) { if (href) {
location.href = href; location.href = href;
} }
@@ -160,7 +160,7 @@
var href = $("#search-seq-nav a[rel=next]").attr("href"); var href = $("#search-seq-nav a[rel=next]").attr("href");
location.href = href; location.href = href;
} else { } else {
var href = $("#pool-nav a.active[rel=next]").attr("href"); var href = $("#pool-nav a.active[rel=next], #favgroup-nav a.active[rel=next]").attr("href");
if (href) { if (href) {
location.href = href; location.href = href;
} }

View File

@@ -235,7 +235,7 @@ class PostPresenter < Presenter
first = true first = true
pools = @post.pools.series_first pools = @post.pools.series_first
pools.each do |pool| pools.each do |pool|
if first && template.params[:tags].blank? if first && template.params[:tags].blank? && template.params[:favgroup_id].blank?
html += pool_link_html(template, pool, :include_rel => true) html += pool_link_html(template, pool, :include_rel => true)
first = false first = false
else else

View File

@@ -2,18 +2,20 @@
<ul> <ul>
<% post.favorite_groups.each do |favgroup| %> <% post.favorite_groups.each do |favgroup| %>
<li> <li>
<% klass = "active" if favgroup.id == params[:favgroup_id].to_i %>
<% if favgroup.neighbors(post).previous %> <% if favgroup.neighbors(post).previous %>
<%= link_to("&lsaquo;&thinsp;prev".html_safe, post_path(favgroup.neighbors(post).previous), :rel => "prev", :class => "prev") %> <%= link_to("&lsaquo;&thinsp;prev".html_safe, post_path(favgroup.neighbors(post).previous, :favgroup_id => favgroup.id), :rel => "prev", :class => "prev #{klass}") %>
<% else %> <% else %>
<span class="prev">&lsaquo;&thinsp;prev</span> <span class="prev">&lsaquo;&thinsp;prev</span>
<% end %> <% end %>
<span class="favgroup-name"> <span class="favgroup-name <%= klass %>">
<%= link_to("Favorite group: #{favgroup.name}", favorite_group_path(favgroup)) %> <%= link_to("Favorite group: #{favgroup.name}", favorite_group_path(favgroup)) %>
</span> </span>
<% if favgroup.neighbors(post).next %> <% if favgroup.neighbors(post).next %>
<%= link_to("next&thinsp;&rsaquo;".html_safe, post_path(favgroup.neighbors(post).next), :rel => "next", :class => "next") %> <%= link_to("next&thinsp;&rsaquo;".html_safe, post_path(favgroup.neighbors(post).next, :favgroup_id => favgroup.id), :rel => "next", :class => "next #{klass}") %>
<% else %> <% else %>
<span class="next">next&thinsp;&rsaquo;</span> <span class="next">next&thinsp;&rsaquo;</span>
<% end %> <% end %>