Class: Ckeditor::AttachmentFile
- Inherits:
-
Asset
- Object
- Asset
- Ckeditor::AttachmentFile
- Defined in:
- app/models/ckeditor/attachment_file.rb
Instance Method Summary collapse
Instance Method Details
#to_json(options = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'app/models/ckeditor/attachment_file.rb', line 29 def to_json( = {}) [:methods] ||= [] [:methods] << :url_content [:methods] << :url_thumb super end |
#url(*args) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/models/ckeditor/attachment_file.rb', line 3 def url(*args) if [:thumb, :content].include?(args.first) send("url_#{args.first}") else data.url(*args) end end |
#url_content ⇒ Object
11 12 13 |
# File 'app/models/ckeditor/attachment_file.rb', line 11 def url_content data.url end |
#url_thumb ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/ckeditor/attachment_file.rb', line 15 def url_thumb extname = File.extname(filename) 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 end |