engine/app/presenters/locomotive/theme_asset_presenter.rb

31 lines
599 B
Ruby
Raw Normal View History

module Locomotive
class ThemeAssetPresenter < BasePresenter
2011-12-07 01:09:13 +00:00
delegate :content_type, :to => :source
def local_path
self.source.local_path(true)
end
def url
self.source.source.url
end
def size
number_to_human_size(self.source.size)
end
2011-12-07 01:09:13 +00:00
def dimensions
self.source.image? ? "#{self.source.width}px x #{self.source.height}px" : nil
end
def updated_at
I18n.l(self.source.updated_at, :format => :short)
end
def included_methods
2011-12-07 01:09:13 +00:00
super + %w(content_type local_path url size dimensions updated_at)
end
end
end