Manage Uploaded Files
A less abstruse interface for deleting files (this time, many at-a-shot). Available from the Edit Web page.
This commit is contained in:
parent
788d1eb075
commit
1d3f7007c6
7 changed files with 58 additions and 2 deletions
|
@ -120,6 +120,23 @@ class AdminController < ApplicationController
|
|||
redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web'
|
||||
end
|
||||
end
|
||||
|
||||
def delete_files
|
||||
return unless is_post
|
||||
some_deleted = false
|
||||
if wiki.authenticate(params['system_password'])
|
||||
params.each do |file, p|
|
||||
if p == 'delete'
|
||||
WikiFile.find_by_file_name(file).destroy
|
||||
some_deleted = true
|
||||
end
|
||||
end
|
||||
flash[:info] = "File(s) successfully deleted." if some_deleted
|
||||
else
|
||||
flash[:error] = password_error(params['system_password'])
|
||||
end
|
||||
redirect_to :controller => 'wiki', :web => @web_name, :action => 'file_list'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class FileController < ApplicationController
|
|||
new_file = @web.wiki_files.create(params['file'])
|
||||
if new_file.valid?
|
||||
flash[:info] = "File '#{@file_name}' successfully uploaded"
|
||||
return_to_last_remembered
|
||||
redirect_to_page(@page_name)
|
||||
else
|
||||
# pass the file with errors back into the form
|
||||
@file = new_file
|
||||
|
@ -34,7 +34,7 @@ class FileController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def delete
|
||||
@file_name = params['id']
|
||||
file = WikiFile.find_by_file_name(@file_name)
|
||||
|
|
|
@ -53,6 +53,10 @@ class WikiController < ApplicationController
|
|||
@authors = @page_names_by_author.keys.sort
|
||||
end
|
||||
|
||||
def file_list
|
||||
@web.file_list
|
||||
end
|
||||
|
||||
def export_html
|
||||
stylesheet = File.read(File.join(RAILS_ROOT, 'public', 'stylesheets', 'instiki.css'))
|
||||
export_pages_as_zip('html') do |page|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue