Move delete checkboxes to js
This commit is contained in:
parent
18e18a4add
commit
c32b0dd4b4
|
@ -1,5 +1,14 @@
|
||||||
$(document).on('click', '.list-remove', function(){
|
$(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(){
|
$(document).on('click', '#check_all', function(){
|
||||||
|
|
|
@ -87,8 +87,8 @@ class Admin::AssetsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
if params[:to_delete]
|
if params[:ids]
|
||||||
asset = Asset.any_in(:_id => params[:to_delete]).delete_all
|
asset = Asset.any_in(:_id => params[:ids]).delete_all
|
||||||
end
|
end
|
||||||
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,8 +86,8 @@ class Admin::DesignsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
if params[:to_delete]
|
if params[:ids]
|
||||||
designs = Design.any_in(:_id => params[:to_delete]).delete_all
|
designs = Design.any_in(:_id => params[:ids]).delete_all
|
||||||
end
|
end
|
||||||
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,13 +20,13 @@ module OrbitBackendHelper
|
||||||
' active' if (@filter[type].include?(id.to_s) rescue nil)
|
' active' if (@filter[type].include?(id.to_s) rescue nil)
|
||||||
end
|
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 :table, :class => "table main-list" do
|
||||||
content_tag :thead do
|
content_tag :thead do
|
||||||
content_tag :tr, :class => "sort-header" do
|
content_tag :tr, :class => "sort-header" do
|
||||||
concat (content_tag :th, :class => "span1 strong" do
|
concat (content_tag :th, :class => "span1 strong" do
|
||||||
concat check_box_tag :check_all
|
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)))
|
end) if (delete_all && (is_admin? || (is_manager? rescue nil)))
|
||||||
titles.each do |title|
|
titles.each do |title|
|
||||||
concat render_title(title[0], title[1], title[2], title[3])
|
concat render_title(title[0], title[1], title[2], title[3])
|
||||||
|
|
|
@ -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'],
|
['description', 'description', 'span1-2', 'admin.data'],
|
||||||
['intro', 'intro', 'span1-2', 'admin.file_type'],
|
['intro', 'intro', 'span1-2', 'admin.file_type'],
|
||||||
['intro', 'intro', 'span1-2', 'admin.file_length'],
|
['intro', 'intro', 'span1-2', 'admin.file_length'],
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<%= 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 'filter' %>
|
||||||
<table id="asset_sort_list" class="table main-list">
|
<table id="asset_sort_list" class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -16,7 +15,6 @@
|
||||||
<%= render :partial => 'asset', :collection => @assets %>
|
<%= render :partial => 'asset', :collection => @assets %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
<%= render_sort_bar(true, ['title', 'title','span7', 'admin.title'],
|
<%= render_sort_bar(true, delete_admin_designs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||||
|
['title', 'title','span7', 'admin.title'],
|
||||||
['author', 'author', 'span2', 'admin.author'],
|
['author', 'author', 'span2', 'admin.author'],
|
||||||
['intro', 'intro', 'span2', 'admin.intro']).html_safe %>
|
['intro', 'intro', 'span2', 'admin.intro']).html_safe %>
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
<%= render 'admin/sites/side_bar' %>
|
<%= render 'admin/sites/side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_for :news_bulletins, :url => delete_admin_designs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
|
|
||||||
<%= render 'filter' %>
|
<%= render 'filter' %>
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<%= render 'designs' %>
|
<%= render 'designs' %>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %>
|
||||||
|
|
|
@ -17,7 +17,7 @@ Orbit::Application.routes.draw do
|
||||||
resources :assets do
|
resources :assets do
|
||||||
collection do
|
collection do
|
||||||
get 'file_upload'
|
get 'file_upload'
|
||||||
post 'delete'
|
get 'delete'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :asset_categories
|
resources :asset_categories
|
||||||
|
@ -53,7 +53,7 @@ Orbit::Application.routes.draw do
|
||||||
resources :designs do
|
resources :designs do
|
||||||
collection do
|
collection do
|
||||||
get 'upload_package'
|
get 'upload_package'
|
||||||
post 'delete'
|
get 'delete'
|
||||||
post 'upload_package'
|
post 'upload_package'
|
||||||
end
|
end
|
||||||
member do
|
member do
|
||||||
|
|
|
@ -292,8 +292,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
if params[:to_delete]
|
if params[:ids]
|
||||||
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
|
bulletins = Bulletin.any_in(:_id => params[:ids]).delete_all
|
||||||
end
|
end
|
||||||
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'bulletin.status'],
|
<%= render_sort_bar(true, delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
||||||
|
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'bulletin.status'],
|
||||||
['category', 'bulletin_category', 'span1-2', 'bulletin.category'],
|
['category', 'bulletin_category', 'span1-2', 'bulletin.category'],
|
||||||
['title', 'title','span7', 'bulletin.title'],
|
['title', 'title','span7', 'bulletin.title'],
|
||||||
['start_date', 'postdate', 'span1-2', 'bulletin.start_date'],
|
['start_date', 'postdate', 'span1-2', 'bulletin.start_date'],
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_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 'filter' %>
|
||||||
<table id="bulettin_sort_list" class="table main-list">
|
<table id="bulettin_sort_list" class="table main-list">
|
||||||
<%= render 'bulletins' %>
|
<%= render 'bulletins' %>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' %>
|
||||||
|
|
|
@ -15,7 +15,7 @@ Rails.application.routes.draw do
|
||||||
get 'load_quick_edit'
|
get 'load_quick_edit'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
post 'delete'
|
get 'delete'
|
||||||
end
|
end
|
||||||
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
||||||
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||||
|
|
|
@ -329,8 +329,8 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
if params[:to_delete]
|
if params[:ids]
|
||||||
news_bulletins = NewsBulletin.any_in(:_id => params[:to_delete]).delete_all
|
news_bulletins = NewsBulletin.any_in(:_id => params[:ids]).delete_all
|
||||||
end
|
end
|
||||||
redirect_to panel_news_back_end_news_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
redirect_to panel_news_back_end_news_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'],
|
<%= render_sort_bar(true, delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
||||||
|
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'],
|
||||||
['category', 'news_bulletin_category', 'span1-2', 'news_bulletin.category'],
|
['category', 'news_bulletin_category', 'span1-2', 'news_bulletin.category'],
|
||||||
['title', 'title','span7', 'news_bulletin.title'],
|
['title', 'title','span7', 'news_bulletin.title'],
|
||||||
['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'],
|
['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'],
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<%= form_for :news_bulletins, :url => delete_panel_news_back_end_news_bulletins_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 'filter' %>
|
||||||
<table id="bulettin_sort_list" class="table main-list">
|
<table id="bulettin_sort_list" class="table main-list">
|
||||||
<%= render 'news_bulletins' %>
|
<%= render 'news_bulletins' %>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
|
||||||
|
|
|
@ -15,7 +15,7 @@ Rails.application.routes.draw do
|
||||||
get 'load_quick_edit'
|
get 'load_quick_edit'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
post 'delete'
|
get 'delete'
|
||||||
end
|
end
|
||||||
match "file_quick_add/:news_bulletin_id" => "news_bulletins#file_quick_add" ,:as => :file_quick_add
|
match "file_quick_add/:news_bulletin_id" => "news_bulletins#file_quick_add" ,:as => :file_quick_add
|
||||||
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
|
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<%= render_sort_bar(false, ['name', 'page','span7', 'page_context.name'],
|
<%= render_sort_bar(false, nil, ['name', 'page','span7', 'page_context.name'],
|
||||||
['version', 'version', 'span2', 'page_context.version'],
|
['version', 'version', 'span2', 'page_context.version'],
|
||||||
['update_time', 'updated_at', 'span2', 'page_context.update_time'],
|
['update_time', 'updated_at', 'span2', 'page_context.update_time'],
|
||||||
['last_modified', 'update_user_id', 'span2', 'page_context.last_modified']).html_safe %>
|
['last_modified', 'update_user_id', 'span2', 'page_context.last_modified']).html_safe %>
|
||||||
|
|
|
@ -124,8 +124,8 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
if params[:to_delete]
|
if params[:ids]
|
||||||
web_links = WebLink.any_in(:_id => params[:to_delete]).delete_all
|
web_links = WebLink.any_in(:_id => params[:ids]).delete_all
|
||||||
end
|
end
|
||||||
redirect_to panel_web_resource_back_end_web_links_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
redirect_to panel_web_resource_back_end_web_links_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', 'bulletin.status'],
|
<%= render_sort_bar(true, delete_panel_web_resource_back_end_web_links_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||||
|
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', 'bulletin.status'],
|
||||||
['category', 'bulletin_category', 'span2', 'bulletin.category'],
|
['category', 'bulletin_category', 'span2', 'bulletin.category'],
|
||||||
['title', 'title','span3', 'bulletin.title'],
|
['title', 'title','span3', 'bulletin.title'],
|
||||||
['tags', 'tags', 'span2', 'bulletin.tags']).html_safe %>
|
['tags', 'tags', 'span2', 'bulletin.tags']).html_safe %>
|
|
@ -1,4 +1,3 @@
|
||||||
<%= form_for :news_bulletins, :url => delete_panel_web_resource_back_end_web_links_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
|
|
||||||
<%= render 'filter' %>
|
<%= render 'filter' %>
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -14,7 +13,6 @@
|
||||||
<%= render :partial => 'web_link', :collection => @web_links %>
|
<%= render :partial => 'web_link', :collection => @web_links %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path, :class => 'btn btn-primary pull-right' %>
|
||||||
|
|
|
@ -6,7 +6,7 @@ Rails.application.routes.draw do
|
||||||
root :to => "web_links#index"
|
root :to => "web_links#index"
|
||||||
resources :web_links do
|
resources :web_links do
|
||||||
collection do
|
collection do
|
||||||
post 'delete'
|
get 'delete'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :web_link_categorys
|
resources :web_link_categorys
|
||||||
|
|
Loading…
Reference in New Issue