Add move operation for documents plugin
This commit is contained in:
parent
3fb3fa409b
commit
3a4519757e
10 changed files with 41 additions and 0 deletions
|
|
@ -43,6 +43,14 @@ class DocumentsController < ApplicationController
|
|||
redirect_to @document.parent || documents_path, alert: t('.error', error: error.message)
|
||||
end
|
||||
|
||||
def update
|
||||
@document = Document.find(params[:id])
|
||||
@document.update_attribute(:parent_id, params[:parent_id])
|
||||
redirect_to @document.parent || documents_path, notice: t('.notice')
|
||||
rescue => error
|
||||
redirect_to @document.parent || documents_path, alert: t('errors.general_msg', msg: error.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@document = Document.find(params[:id])
|
||||
if @document.created_by == current_user or current_user.role_admin?
|
||||
|
|
@ -65,6 +73,10 @@ class DocumentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def move
|
||||
@document = Document.find(params[:document_id])
|
||||
end
|
||||
|
||||
def allowed_mime?(mime)
|
||||
whitelist = FoodsoftConfig[:documents_allowed_extension].split
|
||||
MIME::Types.type_for(whitelist).each do |type|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue