Sha256: e476b48d393dd1bcff8e09a7d9551ce7321d81a1851d3656a3053d427078f840

Contents?: true

Size: 1.03 KB

Versions: 16

Compression:

Stored size: 1.03 KB

Contents

class Ckeditor::ApplicationController < ::ApplicationController
  respond_to :html, :json
  
  before_filter :set_locale
  before_filter :find_asset, :only => [:destroy]
  before_filter :ckeditor_authenticate

  protected
    
    def set_locale
      if !params[:langCode].blank? && I18n.available_locales.include?(params[:langCode].to_sym)
        I18n.locale = params[:langCode]
      end
    end
    
    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

16 entries across 16 versions & 3 rubygems

Version Path
glebtv-ckeditor-4.0.2.7 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.2.6 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.2.5 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.2.4 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.2.2 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.2.1 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.2 app/controllers/ckeditor/application_controller.rb
glebtv-ckeditor-4.0.1 app/controllers/ckeditor/application_controller.rb
lafeber_ckeditor-3.7.3 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.3 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.2 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.1 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.0 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.0.rc3 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.0.rc2 app/controllers/ckeditor/application_controller.rb
ckeditor-3.7.0.rc1 app/controllers/ckeditor/application_controller.rb