Class: Pageflow::Editor::FilesController Private
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Pageflow::Editor::FilesController
- Defined in:
- app/controllers/pageflow/editor/files_controller.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #create ⇒ Object private
- #destroy ⇒ Object private
- #index ⇒ Object private
- #publish ⇒ Object private
- #retry ⇒ Object private
- #reuse ⇒ Object private
- #update ⇒ Object private
Instance Method Details
#create ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 18 def create entry = DraftEntry.find(params[:entry_id]) (:edit, entry.to_model) verify_edit_lock!(entry) @file = entry.create_file!(file_type, create_params) @file.publish! if params[:no_upload] respond_with(:editor, @file) rescue ActiveRecord::RecordInvalid, DraftEntry::InvalidForeignKeyCustomAttributeError => e debug_log_with_backtrace(e) head :unprocessable_entity end |
#destroy ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 85 86 87 88 89 90 91 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 82 def destroy entry = DraftEntry.find(params[:entry_id]) file = entry.find_file(file_type.model, params[:id]) (:edit, entry.to_model) verify_edit_lock!(entry) entry.remove_file(file) head(:no_content) end |
#index ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 9 def index entry = DraftEntry.find(params[:entry_id]) (:use_files, entry.to_model) @files = entry.find_files(file_type.model) respond_with(:editor, @files) end |
#publish ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 59 def publish entry = DraftEntry.find(params[:entry_id]) file = entry.find_file(file_type.model, params[:id]) (:update, file.to_model) file.publish! head(:no_content) end |
#retry ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 45 def retry entry = DraftEntry.find(params[:entry_id]) file = entry.find_file(file_type.model, params[:id]) (:retry, file.to_model) file.retry! respond_with(:editor, file, location: editor_entry_file_url(file, entry, collection_name: params[:collection_name])) end |
#reuse ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 32 def reuse entry = DraftEntry.find(params[:entry_id]) file_reuse = build_file_reuse(entry) (:edit, entry.to_model) (:use, file_reuse.file.to_model) verify_edit_lock!(entry) file_reuse.save! redirect_to(editor_entry_url(entry)) end |
#update ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/controllers/pageflow/editor/files_controller.rb', line 69 def update entry = DraftEntry.find(params[:entry_id]) file = entry.find_file(file_type.model, params[:id]) (:update, file.to_model) file.update!(update_params) head(:no_content) rescue ActiveRecord::RecordInvalid => e debug_log_with_backtrace(e) head :unprocessable_entity end |