Add order page for favgroups
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
this.initialize_add_to_pool_link();
|
this.initialize_add_to_pool_link();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#c-pool-orders").length) {
|
if ($("#c-pool-orders,#c-favorite-group-orders").length) {
|
||||||
this.initialize_simple_edit();
|
this.initialize_simple_edit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ div#c-pools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div#c-pool-orders {
|
div#c-pool-orders, div#c-favorite-group-orders {
|
||||||
h1 {
|
h1 {
|
||||||
font-size: $h2_size;
|
font-size: $h2_size;
|
||||||
}
|
}
|
||||||
|
|||||||
9
app/controllers/favorite_group_orders_controller.rb
Normal file
9
app/controllers/favorite_group_orders_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class FavoriteGroupOrdersController < ApplicationController
|
||||||
|
respond_to :html, :xml, :json, :js
|
||||||
|
before_filter :member_only
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@favorite_group = FavoriteGroup.find(params[:favorite_group_id])
|
||||||
|
respond_with(@favorite_group)
|
||||||
|
end
|
||||||
|
end
|
||||||
24
app/views/favorite_group_orders/edit.html.erb
Normal file
24
app/views/favorite_group_orders/edit.html.erb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<div id="c-favorite-group-orders">
|
||||||
|
<div id="a-edit">
|
||||||
|
<h1>Order Favorite Group: <%= @favorite_group.pretty_name %></h1>
|
||||||
|
<p>Drag and drop the list below to determine ordering.</p>
|
||||||
|
|
||||||
|
<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 %>">
|
||||||
|
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<%= simple_form_for(@favorite_group, :format => :js, :html => {:id => "ordering-form"}) do |f| %>
|
||||||
|
<%= submit_tag "Save" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render "favorite_groups/secondary_links" %>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Order Favorite Group - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -13,6 +13,9 @@
|
|||||||
<% if @favorite_group.editable_by?(CurrentUser.user) %>
|
<% if @favorite_group.editable_by?(CurrentUser.user) %>
|
||||||
<li><%= link_to "Edit", edit_favorite_group_path(@favorite_group) %></li>
|
<li><%= link_to "Edit", edit_favorite_group_path(@favorite_group) %></li>
|
||||||
<li><%= link_to "Delete", favorite_group_path(@favorite_group), :method => :delete, :data => {:confirm => "Are you sure you want to delete this favorite group?"} %></li>
|
<li><%= link_to "Delete", favorite_group_path(@favorite_group), :method => :delete, :data => {:confirm => "Are you sure you want to delete this favorite group?"} %></li>
|
||||||
|
<% if @favorite_group.post_count <= 100 %>
|
||||||
|
<li><%= link_to "Order", edit_favorite_group_order_path(@favorite_group) %></li>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -109,7 +109,9 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
resource :dtext_preview, :only => [:create]
|
resource :dtext_preview, :only => [:create]
|
||||||
resources :favorites
|
resources :favorites
|
||||||
resources :favorite_groups
|
resources :favorite_groups do
|
||||||
|
resource :order, :only => [:edit], :controller => "favorite_group_orders"
|
||||||
|
end
|
||||||
resources :forum_posts do
|
resources :forum_posts do
|
||||||
member do
|
member do
|
||||||
post :undelete
|
post :undelete
|
||||||
@@ -164,7 +166,7 @@ Rails.application.routes.draw do
|
|||||||
collection do
|
collection do
|
||||||
get :gallery
|
get :gallery
|
||||||
end
|
end
|
||||||
resource :order, :only => [:edit, :update], :controller => "pool_orders"
|
resource :order, :only => [:edit], :controller => "pool_orders"
|
||||||
end
|
end
|
||||||
resource :pool_element, :only => [:create, :destroy] do
|
resource :pool_element, :only => [:create, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
|
|||||||
Reference in New Issue
Block a user