Class: Archangel::Backend::AssetsController
- Inherits:
-
Archangel::BackendController
- Object
- ActionController::Base
- ApplicationController
- Archangel::BackendController
- Archangel::Backend::AssetsController
- Includes:
- Controllers::ResourcefulConcern
- Defined in:
- app/controllers/archangel/backend/assets_controller.rb
Overview
Backend assets controller
Instance Method Summary collapse
-
#wysiwyg ⇒ Object
Create backend asset from WYSIWYG upload.
Methods included from Controllers::ResourcefulConcern
#create, #destroy, #edit, #index, #new, #show, #update
Methods included from Helpers::ActionableConcern
#action, #collection_action?, #member_action?
Methods included from Controllers::MetatagableConcern
Methods inherited from ApplicationController
#current_site, #render_401_error, #render_404_error, #render_error
Methods included from Controllers::PaginatableConcern
Instance Method Details
#wysiwyg ⇒ Object
Create backend asset from WYSIWYG upload
Formats
JSON
Request
POST /backend/wysiwyg
POST /backend/wysiwyg.json
Parameters
{
"file": "local/path/to/new_file.gif"
}
Response
{
"success": true,
"url": "file_name.gif"
}
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/archangel/backend/assets_controller.rb', line 35 def wysiwyg asset = resource_wysiwyg_content resource = { success: asset.valid?, error: asset.errors..first } resource = resource.merge(url: asset.file.url) if asset.save render json: resource.reject { |key, val| key == :error && val.blank? } end |