favgroups: convert post_ids from string to array.
This commit is contained in:
@@ -1,25 +1,34 @@
|
||||
<div id="favgroup-nav">
|
||||
<ul>
|
||||
<% post.favorite_groups(active_id=params[:favgroup_id]).each do |favgroup| %>
|
||||
<li>
|
||||
<% klass = "active" if favgroup.id == params[:favgroup_id].to_i %>
|
||||
<% favgroups = favgroups.sort_by { |favgroup| [(favgroup.id == params[:favgroup_id].to_i) ? 0 : 1, favgroup.name] } %>
|
||||
<% favgroups.each do |favgroup| %>
|
||||
<% selected = favgroup.id == params[:favgroup_id].to_i %>
|
||||
|
||||
<% if favgroup.neighbors(post).previous %>
|
||||
<%= link_to("‹ prev".html_safe, post_path(favgroup.neighbors(post).previous, :favgroup_id => favgroup.id), :rel => "prev", :class => "prev #{klass}") %>
|
||||
<% else %>
|
||||
<span class="prev">‹ prev</span>
|
||||
<% end %>
|
||||
|
||||
<span class="favgroup-name <%= klass %>">
|
||||
<%= link_to("Favorite group: #{favgroup.pretty_name}", favorite_group_path(favgroup)) %>
|
||||
<%= tag.li id: "nav-link-for-favgroup-#{favgroup.id}", "data-selected": selected do %>
|
||||
<span class="first">
|
||||
<%= link_to_unless favgroup.first_post?(post.id), "«", post_path(favgroup.post_ids.first, favgroup_id: favgroup.id) %>
|
||||
</span>
|
||||
|
||||
<% if favgroup.neighbors(post).next %>
|
||||
<%= link_to("next ›".html_safe, post_path(favgroup.neighbors(post).next, :favgroup_id => favgroup.id), :rel => "next", :class => "next #{klass}") %>
|
||||
<% else %>
|
||||
<span class="next">next ›</span>
|
||||
<% favgroup.previous_post_id(post.id).tap do |previous_post_id| %>
|
||||
<span class="prev">
|
||||
<%= link_to_if previous_post_id, "‹ prev", post_path(previous_post_id.to_i, favgroup_id: favgroup.id), rel: ("prev" if selected) %>
|
||||
</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<span class="favgroup-name">
|
||||
<%= link_to "Favorite group: #{favgroup.pretty_name}", favgroup %>
|
||||
</span>
|
||||
|
||||
<% favgroup.next_post_id(post.id).tap do |next_post_id| %>
|
||||
<span class="next">
|
||||
<%= link_to_if next_post_id, "next ›", post_path(next_post_id.to_i, favgroup_id: favgroup.id), rel: ("next" if selected) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<span class="last">
|
||||
<%= link_to_unless favgroup.last_post?(post.id), "»", post_path(favgroup.post_ids.last, favgroup_id: favgroup.id) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
<% end %>
|
||||
|
||||
<% if post.pools.undeleted.present? %>
|
||||
<%= render "posts/partials/show/pool_list", post: post, pools: post.pools.undeleted.selected_first(params[:pool_id]) %>
|
||||
<%= render "posts/partials/show/pool_list", post: post, pools: post.pools.undeleted %>
|
||||
<% end %>
|
||||
|
||||
<% if post.favorite_groups(active_id=params[:favgroup_id]).any? %>
|
||||
<%= render "posts/partials/show/favorite_groups", :post => post %>
|
||||
<% if CurrentUser.user.favorite_groups.for_post(post.id).present? %>
|
||||
<%= render "posts/partials/show/favorite_groups", post: post, favgroups: CurrentUser.user.favorite_groups.for_post(post.id) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div id="pool-nav">
|
||||
<ul>
|
||||
<% pools = pools.sort_by { |pool| [is_pool_selected?(pool) ? 0 : 1, pool.is_series? ? 0 : 1, pool.name] } %>
|
||||
<% pools.each do |pool| %>
|
||||
<%= render "posts/partials/show/pool_list_item", pool: pool, post: post, selected: is_pool_selected?(pool) %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= content_tag :li, id: "nav-link-for-pool-#{pool.id}", class: "pool-category-#{pool.category} pool-selected-#{selected}" do -%>
|
||||
<%= tag.li id: "nav-link-for-pool-#{pool.id}", class: "pool-category-#{pool.category}", "data-selected": selected do -%>
|
||||
<% if !pool.first_post?(post.id) && pool.post_ids.first -%>
|
||||
<%= link_to("«".html_safe, post_path(pool.post_ids.first, pool_id: pool.id), class: "first", title: "to page 1") %>
|
||||
<% else -%>
|
||||
|
||||
Reference in New Issue
Block a user