Sha256: d38ee66abdddd45d2caa391677092cc3af8ece5e0396a4e071c5188dbbeedcca

Contents?: true

Size: 685 Bytes

Versions: 5

Compression:

Stored size: 685 Bytes

Contents

module Ckeditor::BaseHelper
  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/attachments'
    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 & 3 rubygems

Version Path
ckeditor-3.5.2 app/helpers/ckeditor/base_helper.rb
ckeditor-3.5.1 app/helpers/ckeditor/base_helper.rb
dust-ckeditor-3.5.0 app/helpers/ckeditor/base_helper.rb
hifi-ckeditor-3.5.2 app/helpers/ckeditor/base_helper.rb
hifi-ckeditor-3.5.1 app/helpers/ckeditor/base_helper.rb