Class: Optimacms::TinymceAssetsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/optimacms/tinymce_assets_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_lang, #not_found

Instance Method Details

#createObject


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/optimacms/tinymce_assets_controller.rb', line 3

def create
  # Take upload from params[:file] and store it somehow...
  # Optionally also accept params[:hint] and consume if needed

  #params.require(:photo).permit(:title, :description, :photo)
  #@item = model.build item_params

  item = Optimacms::Mediafile.new(:photo=>params[:file])
  res = item.save


  render json: {
    image: {
      #url: view_context.image_url(item.photo_url)
      url: item.photo.url
    }
  }, content_type: "text/html"
end