Class: Archangel::Backend::AssetsController

Inherits:
Archangel::BackendController show all
Includes:
Controllers::ResourcefulConcern
Defined in:
app/controllers/archangel/backend/assets_controller.rb

Overview

Backend assets controller

Instance Method Summary collapse

Methods included from Controllers::ResourcefulConcern

#create, #destroy, #edit, #index, #new, #show, #update

Methods included from Controllers::MetatagableConcern

#assign_meta_tags

Methods inherited from ApplicationController

#current_site, #render_401_error, #render_404_error, #render_error

Methods included from Controllers::PaginatableConcern

#page_num, #per_page

Methods included from Controllers::ActionableConcern

#action, #collection_action?, #member_action?

Instance Method Details

#wysiwygObject

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
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