Sha256: c8783bd5395995bdc100ec983f675d4dd60090e772d7ffef6efe385677d6179e

Contents?: true

Size: 682 Bytes

Versions: 5

Compression:

Stored size: 682 Bytes

Contents

module CkeditorHelper
  def ckeditor_attachment_path(kind)
    path = case kind
      when :image then Ckeditor.file_manager_image_upload_uri
      when :file  then Ckeditor.file_manager_upload_uri
      else '/ckeditor/create/default'
    end
    
    session_key = Rails.application.config.send(:session_options)[:key]
    
    options = Rails.application.routes.recognize_path(path, :method => :post)
    options[:protocol] = "http://"
    options[session_key] = Rack::Utils.escape(cookies[session_key])
    
    if protect_against_forgery?
      options[request_forgery_protection_token] = Rack::Utils.escape(form_authenticity_token)
    end
    
    url_for(options)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ckeditor-3.4.3.pre app/helpers/ckeditor_helper.rb
ckeditor-3.4.2.pre app/helpers/ckeditor_helper.rb
ckeditor-3.4.1.pre app/helpers/ckeditor_helper.rb
ckeditor-3.4.0.pre app/helpers/ckeditor_helper.rb
ckeditor-3.2.4 app/helpers/ckeditor_helper.rb