Sha256: 422675b06780d8f070adf357b2c99cbb304a557c50b4953f85c758d277461337

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

class Ckeditor::ApplicationController < ::ApplicationController
  respond_to :html, :json
  
  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
        body = params[:CKEditor].blank? ? asset.to_json(:only=>[:id, :type]) : %Q"<script type='text/javascript'>
          window.parent.CKEDITOR.tools.callFunction(#{params[:CKEditorFuncNum]}, '#{Ckeditor::Utils.escape_single_quotes(asset.url_content)}');
        </script>"
        
        render :text => body
      else
        render :nothing => true
      end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ckeditor-4.0.0 app/controllers/ckeditor/application_controller.rb
ckeditor-4.0.0.rc2 app/controllers/ckeditor/application_controller.rb
ckeditor-4.0.0.rc1 app/controllers/ckeditor/application_controller.rb