2011-12-05 12:29:58 +00:00
|
|
|
module Locomotive
|
|
|
|
class SnippetPresenter < BasePresenter
|
|
|
|
|
|
|
|
delegate :name, :slug, :template, :to => :source
|
|
|
|
|
2011-12-06 11:39:32 +00:00
|
|
|
def updated_at
|
|
|
|
I18n.l(self.source.updated_at, :format => :short)
|
|
|
|
end
|
|
|
|
|
2011-12-05 12:29:58 +00:00
|
|
|
def included_methods
|
2011-12-06 11:39:32 +00:00
|
|
|
super + %w(name slug template updated_at)
|
2011-12-05 12:29:58 +00:00
|
|
|
end
|
|
|
|
|
2011-12-08 15:47:17 +00:00
|
|
|
def as_json_for_html_view
|
|
|
|
methods = included_methods.clone - %w(template)
|
|
|
|
self.as_json(methods)
|
|
|
|
end
|
|
|
|
|
2011-12-05 12:29:58 +00:00
|
|
|
end
|
|
|
|
end
|