diff --git a/app/assets/javascripts/pools.js b/app/assets/javascripts/pools.js index 1f5941a05..a4aa36f89 100644 --- a/app/assets/javascripts/pools.js +++ b/app/assets/javascripts/pools.js @@ -12,7 +12,7 @@ this.initialize_add_to_pool_link(); } - if ($("#c-pool-orders").length) { + if ($("#c-pool-orders,#c-favorite-group-orders").length) { this.initialize_simple_edit(); } } diff --git a/app/assets/stylesheets/specific/pools.css.scss b/app/assets/stylesheets/specific/pools.css.scss index 95b771235..502ba112a 100644 --- a/app/assets/stylesheets/specific/pools.css.scss +++ b/app/assets/stylesheets/specific/pools.css.scss @@ -53,7 +53,7 @@ div#c-pools { } } -div#c-pool-orders { +div#c-pool-orders, div#c-favorite-group-orders { h1 { font-size: $h2_size; } diff --git a/app/controllers/favorite_group_orders_controller.rb b/app/controllers/favorite_group_orders_controller.rb new file mode 100644 index 000000000..2ad325c22 --- /dev/null +++ b/app/controllers/favorite_group_orders_controller.rb @@ -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 diff --git a/app/views/favorite_group_orders/edit.html.erb b/app/views/favorite_group_orders/edit.html.erb new file mode 100644 index 000000000..8c2bf40d6 --- /dev/null +++ b/app/views/favorite_group_orders/edit.html.erb @@ -0,0 +1,24 @@ +
+
+

Order Favorite Group: <%= @favorite_group.pretty_name %>

+

Drag and drop the list below to determine ordering.

+ + + + <%= simple_form_for(@favorite_group, :format => :js, :html => {:id => "ordering-form"}) do |f| %> + <%= submit_tag "Save" %> + <% end %> +
+
+ +<%= render "favorite_groups/secondary_links" %> + +<% content_for(:page_title) do %> + Order Favorite Group - <%= Danbooru.config.app_name %> +<% end %> diff --git a/app/views/favorite_groups/_secondary_links.html.erb b/app/views/favorite_groups/_secondary_links.html.erb index 909f984ee..0a835216a 100644 --- a/app/views/favorite_groups/_secondary_links.html.erb +++ b/app/views/favorite_groups/_secondary_links.html.erb @@ -13,6 +13,9 @@ <% if @favorite_group.editable_by?(CurrentUser.user) %>
  • <%= link_to "Edit", edit_favorite_group_path(@favorite_group) %>
  • <%= link_to "Delete", favorite_group_path(@favorite_group), :method => :delete, :data => {:confirm => "Are you sure you want to delete this favorite group?"} %>
  • + <% if @favorite_group.post_count <= 100 %> +
  • <%= link_to "Order", edit_favorite_group_order_path(@favorite_group) %>
  • + <% end %> <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 923cd3ce4..e17808723 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -109,7 +109,9 @@ Rails.application.routes.draw do end resource :dtext_preview, :only => [:create] resources :favorites - resources :favorite_groups + resources :favorite_groups do + resource :order, :only => [:edit], :controller => "favorite_group_orders" + end resources :forum_posts do member do post :undelete @@ -164,7 +166,7 @@ Rails.application.routes.draw do collection do get :gallery end - resource :order, :only => [:edit, :update], :controller => "pool_orders" + resource :order, :only => [:edit], :controller => "pool_orders" end resource :pool_element, :only => [:create, :destroy] do collection do