Sha256: f434601b260b252b35a59437611e977490e18455d3e3b5d4ddee9dc274262b24

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

class Ckeditor::ApplicationController < ApplicationController
  layout 'ckeditor/application'

  before_filter :find_asset, :only => [:destroy]
  before_filter :ckeditor_authorize!
  before_filter :authorize_resource

  protected

    def respond_with_asset(asset)
      file = params[:CKEditor].blank? ? params[:qqfile] : params[:upload]
      asset.data = Ckeditor::Http.normalize_param(file, request)

      callback = ckeditor_before_create_asset(asset)

      if callback && asset.save
        if params[:CKEditor].blank?
          render :json => asset.to_json(:only=>[:id, :type])
        else
          render :text => %Q"<script type='text/javascript'>
              window.parent.CKEDITOR.tools.callFunction(#{params[:CKEditorFuncNum]}, '#{config.relative_url_root}#{Ckeditor::Utils.escape_single_quotes(asset.url_content)}');
            </script>"
        end
      else
        if params[:CKEditor].blank?
          render :nothing => true, :format => :json
        else
          render :text => %Q"<script type='text/javascript'>
              window.parent.CKEDITOR.tools.callFunction(#{params[:CKEditorFuncNum]}, null, '#{Ckeditor::Utils.escape_single_quotes(asset.errors.full_messages.first)}');
            </script>"
        end
      end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ckeditor-4.1.3 app/controllers/ckeditor/application_controller.rb
ckeditor-4.1.2 app/controllers/ckeditor/application_controller.rb