Sha256: 7c00869dd265ae4d69bf9f3c85ec03b164c6ca5163dfe0b5f4accfb9eabfda53

Contents?: true

Size: 922 Bytes

Versions: 52

Compression:

Stored size: 922 Bytes

Contents

class Ckeditor::AttachmentFile < Ckeditor::Asset

  def url(*args)
    if [:thumb, :content].include?(args.first)
      send("url_#{args.first}")
    else
      data.url(*args)
    end
  end

  def url_content
	  data.url
	end

	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

	def to_json(options = {})
	  options[:methods] ||= []
	  options[:methods] << :url_content
	  options[:methods] << :url_thumb
	  super options
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
site_logic-1.9.13 app/models/ckeditor/attachment_file.rb
site_logic-1.9.12 app/models/ckeditor/attachment_file.rb
site_logic-1.9.11 app/models/ckeditor/attachment_file.rb
site_logic-1.9.10 app/models/ckeditor/attachment_file.rb
site_logic-1.9.9 app/models/ckeditor/attachment_file.rb
site_logic-1.9.8 app/models/ckeditor/attachment_file.rb
site_logic-1.9.7 app/models/ckeditor/attachment_file.rb
site_logic-1.9.6 app/models/ckeditor/attachment_file.rb
blog_logic-1.4.5 app/models/ckeditor/attachment_file.rb
blog_logic-1.4.4 app/models/ckeditor/attachment_file.rb
site_logic-1.9.5 app/models/ckeditor/attachment_file.rb
blog_logic-1.4.3 app/models/ckeditor/attachment_file.rb
blog_logic-1.4.2 app/models/ckeditor/attachment_file.rb
site_logic-1.9.4 app/models/ckeditor/attachment_file.rb
site_logic-1.9.3 app/models/ckeditor/attachment_file.rb
blog_logic-1.4.1 app/models/ckeditor/attachment_file.rb
blog_logic-1.4.0 app/models/ckeditor/attachment_file.rb
blog_logic-1.3.1 app/models/ckeditor/attachment_file.rb
blog_logic-1.3.0 app/models/ckeditor/attachment_file.rb
blog_logic-1.2.4 app/models/ckeditor/attachment_file.rb