Delete Orphan Pages in Category
If a Web has categories defined, you can delete orphaned pages in a given category (in addition to being able to delete all orphaned pages).
This commit is contained in:
parent
61799bc63f
commit
3a78ef3dbf
6 changed files with 60 additions and 3 deletions
|
@ -104,6 +104,23 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def remove_orphaned_pages_in_category
|
||||
unless (request.post? || ENV["RAILS_ENV"] == "test")
|
||||
headers['Allow'] = 'POST'
|
||||
render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error')
|
||||
return
|
||||
end
|
||||
if wiki.authenticate(params['system_password_orphaned_in_category'])
|
||||
category = params['category']
|
||||
wiki.remove_orphaned_pages_in_category(@web_name, category)
|
||||
flash[:info] = "Orphaned pages in category \"#{category}\" removed"
|
||||
redirect_to :controller => 'wiki', :web => @web_name, :action => 'list'
|
||||
else
|
||||
flash[:error] = password_error(params['system_password_orphaned_in_category'])
|
||||
redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web'
|
||||
end
|
||||
end
|
||||
|
||||
def delete_web
|
||||
unless (request.post? || ENV["RAILS_ENV"] == "test")
|
||||
headers['Allow'] = 'POST'
|
||||
|
|
|
@ -15,4 +15,9 @@ class WebSweeper < ActionController::Caching::Sweeper
|
|||
def after_remove_orphaned_pages(web)
|
||||
expire_cached_summary_pages(web)
|
||||
end
|
||||
|
||||
def after_remove_orphaned_pages_in_category(web)
|
||||
expire_cached_summary_pages(web)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue