2011-11-19 14:47:56 +00:00
|
|
|
module Locomotive
|
|
|
|
class ContentAssetPresenter < BasePresenter
|
|
|
|
|
2011-11-21 01:27:05 +00:00
|
|
|
delegate :content_type, :vignette_url, :to => :source
|
|
|
|
|
2011-11-19 15:41:16 +00:00
|
|
|
def full_filename
|
|
|
|
self.source.source_filename
|
|
|
|
end
|
|
|
|
|
2011-11-19 14:47:56 +00:00
|
|
|
def filename
|
2011-11-19 15:41:16 +00:00
|
|
|
truncate(self.source.source_filename, :length => 22)
|
2011-11-19 14:47:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def short_name
|
|
|
|
truncate(self.source.name, :length => 15)
|
|
|
|
end
|
|
|
|
|
|
|
|
def extname
|
|
|
|
truncate(self.source.extname, :length => 3)
|
|
|
|
end
|
|
|
|
|
|
|
|
def content_type_text
|
|
|
|
value = self.source.content_type.to_s == 'other' ? self.extname : self.source.content_type
|
|
|
|
value.blank? ? '?' : value
|
|
|
|
end
|
|
|
|
|
|
|
|
def url
|
|
|
|
self.source.source.url
|
|
|
|
end
|
|
|
|
|
2011-11-21 01:27:05 +00:00
|
|
|
def included_methods
|
|
|
|
super + %w(full_filename filename short_name extname content_type content_type_text url vignette_url)
|
2011-11-19 14:47:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|