Class: Archangel::Backend::AssetsController
- Inherits:
-
Archangel::BackendController
- Object
- ActionController::Base
- ApplicationController
- Archangel::BackendController
- Archangel::Backend::AssetsController
- Includes:
- Controllers::Backend::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 inherited from ApplicationController
#current_site, #render_401_error, #render_404_error, #render_error
Methods included from PaginatableConcern
Methods included from ActionableConcern
#action, #collection_action?, #edit_action?, #index_action?, #member_action?, #new_action?, #restful_action?, #save_action?, #show_action?
Instance Method Details
#wysiwyg ⇒ Object
Create backend asset from WYSIWYG upload
Formats
JSON
Request
POST /backend/wysiwyg
POST /backend/wysiwyg.json
Paramaters
{
"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 47 48 |
# File 'app/controllers/archangel/backend/assets_controller.rb', line 35 def wysiwyg asset = resource_wysiwyg_content asset.save asset_response = { success: true, url: asset.file.url } respond_to do |format| format.json { render json: asset_response } end end |