favgroups: convert post_ids from string to array.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<ul id="sortable">
|
||||
<% @favorite_group.posts(:limit => 1_000).each do |post| %>
|
||||
<li class="ui-state-default" id="favorite_group[post_id_array]_<%= post.id %>">
|
||||
<% @favorite_group.posts.limit(1_000).each do |post| %>
|
||||
<li class="ui-state-default" id="favorite_group[post_ids]_<%= post.id %>">
|
||||
<%= PostPresenter.preview(post).presence || "Hidden: Post ##{post.id}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<%= edit_form_for(@favorite_group) do |f| %>
|
||||
<%= f.input :name, :as => :string, :input_html => { :value => @favorite_group.pretty_name } %>
|
||||
<%= f.input :post_ids, :label => "Posts" %>
|
||||
<%= f.input :post_ids_string, label: "Posts", as: :text %>
|
||||
<%= f.input :is_public %>
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<% end %>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<%= edit_form_for(@favorite_group) do |f| %>
|
||||
<%= f.input :name, :as => :string, :required => true %>
|
||||
<%= f.input :post_ids, :label => "Posts" %>
|
||||
<%= f.input :post_ids_string, :label => "Posts" %>
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
Favorite Group:
|
||||
<%= link_to @favorite_group.pretty_name, posts_path(:tags => "favgroup:#{@favorite_group.id}") %>
|
||||
</h1>
|
||||
|
||||
Creator: <%= link_to_user @favorite_group.creator %>
|
||||
<br>
|
||||
<br>
|
||||
@@ -11,9 +12,13 @@
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<section>
|
||||
<%= @post_set.presenter.post_previews_html(self) %>
|
||||
<% if @favorite_group.post_count == 0 %>
|
||||
<%= render "post_sets/blank" %>
|
||||
<% else %>
|
||||
<%= post_previews_html(@posts, favgroup_id: @favorite_group.id) %>
|
||||
|
||||
<%= numbered_paginator(@post_set) %>
|
||||
<%= numbered_paginator(@posts) %>
|
||||
<% end %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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