diff --git a/app/assets/javascripts/sort_header.js b/app/assets/javascripts/sort_header.js
index 25a16344..ef0f5a9c 100644
--- a/app/assets/javascripts/sort_header.js
+++ b/app/assets/javascripts/sort_header.js
@@ -1,5 +1,14 @@
$(document).on('click', '.list-remove', function(){
- $('#delete_all').submit();
+ var a = [];
+ $('.checkbox_in_list').each(function(){
+ if (this.checked) a.push("ids[]=" + this.value);
+ });
+ var url = $(this).attr('rel');
+ if (url.indexOf('?') > -1){
+ $.getScript(url + '&' + a.join('&'));
+ }else{
+ $.getScript(url + '?' + a.join('&'));
+ }
});
$(document).on('click', '#check_all', function(){
diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb
index 092cb971..6a847a12 100644
--- a/app/controllers/admin/assets_controller.rb
+++ b/app/controllers/admin/assets_controller.rb
@@ -87,8 +87,8 @@ class Admin::AssetsController < OrbitBackendController
end
def delete
- if params[:to_delete]
- asset = Asset.any_in(:_id => params[:to_delete]).delete_all
+ if params[:ids]
+ asset = Asset.any_in(:_id => params[:ids]).delete_all
end
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb
index 84f2b770..9d434ff8 100644
--- a/app/controllers/admin/designs_controller.rb
+++ b/app/controllers/admin/designs_controller.rb
@@ -86,8 +86,8 @@ class Admin::DesignsController < OrbitBackendController
end
def delete
- if params[:to_delete]
- designs = Design.any_in(:_id => params[:to_delete]).delete_all
+ if params[:ids]
+ designs = Design.any_in(:_id => params[:ids]).delete_all
end
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb
index e2865b9f..3bc4d31b 100644
--- a/app/helpers/orbit_backend_helper.rb
+++ b/app/helpers/orbit_backend_helper.rb
@@ -20,13 +20,13 @@ module OrbitBackendHelper
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
- def render_sort_bar(delete_all, *titles)
+ def render_sort_bar(delete_all, url, *titles)
content_tag :table, :class => "table main-list" do
content_tag :thead do
content_tag :tr, :class => "sort-header" do
concat (content_tag :th, :class => "span1 strong" do
concat check_box_tag :check_all
- concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove"
+ concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove", :rel => url
end) if (delete_all && (is_admin? || (is_manager? rescue nil)))
titles.each do |title|
concat render_title(title[0], title[1], title[2], title[3])
diff --git a/app/views/admin/assets/_sort_headers.html.erb b/app/views/admin/assets/_sort_headers.html.erb
index 43cb5927..d266a086 100644
--- a/app/views/admin/assets/_sort_headers.html.erb
+++ b/app/views/admin/assets/_sort_headers.html.erb
@@ -1,4 +1,5 @@
-<%= render_sort_bar(true, ['title', 'title','span4', 'admin.title'],
+<%= render_sort_bar(true, delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
+ ['title', 'title','span4', 'admin.title'],
['description', 'description', 'span1-2', 'admin.data'],
['intro', 'intro', 'span1-2', 'admin.file_type'],
['intro', 'intro', 'span1-2', 'admin.file_length'],
diff --git a/app/views/admin/assets/index.html.erb b/app/views/admin/assets/index.html.erb
index 394e18e8..38ec6b5e 100644
--- a/app/views/admin/assets/index.html.erb
+++ b/app/views/admin/assets/index.html.erb
@@ -1,22 +1,20 @@
-<%= form_for :assets, :url => delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
- <%= render 'filter' %>
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
- <%= render :partial => 'asset', :collection => @assets %>
-
-
-<% end %>
+<%= render 'filter' %>
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ <%= render :partial => 'asset', :collection => @assets %>
+
+