Module: CkeditorHelper
- Defined in:
- app/helpers/ckeditor_helper.rb
Instance Method Summary collapse
Instance Method Details
#ckeditor_attachment_path(kind) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/ckeditor_helper.rb', line 2 def (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 = ActionController::Base.[:key] = ActionController::Routing::Routes.recognize_path(path, :method => :post) [:protocol] = "http://" [session_key] = Rack::Utils.escape([session_key]) if protect_against_forgery? [request_forgery_protection_token] = Rack::Utils.escape(form_authenticity_token) end url_for() end |
#file_image_tag(filename, path) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/ckeditor_helper.rb', line 23 def file_image_tag(filename, path) extname = File.extname(filename) image = case extname.to_s when '.swf' then '/javascripts/ckeditor/images/swf.gif' when '.pdf' then '/javascripts/ckeditor/images/pdf.gif' when '.doc', '.txt' then '/javascripts/ckeditor/images/doc.gif' when '.mp3' then '/javascripts/ckeditor/images/mp3.gif' when '.rar', '.zip', '.tg' then '/javascripts/ckeditor/images/rar.gif' when '.xls' then '/javascripts/ckeditor/images/xls.gif' else '/javascripts/ckeditor/images/ckfnothumb.gif' end image_tag(image, :alt=>path, :title=>filename, :onerror=>"this.src='/javascripts/ckeditor/images/ckfnothumb.gif'", :class=>'image') end |