Class: Tenon::ApplicationDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/tenon/application_decorator.rb

Direct Known Subclasses

AssetDecorator, TenonContent::RowDecorator

Instance Method Summary collapse

Instance Method Details

#edit_pathObject



13
14
15
# File 'app/decorators/tenon/application_decorator.rb', line 13

def edit_path
  h.url_for([:edit, object])
end

#pathObject



9
10
11
# File 'app/decorators/tenon/application_decorator.rb', line 9

def path
  h.url_for(object)
end

#published?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
# File 'app/decorators/tenon/application_decorator.rb', line 17

def published?
  if object.try(:publish_at)
    object.publish_at <= Time.now
  elsif object.respond_to?(:published)
    object.published
  else
    true
  end
end

#serializer_classObject



5
6
7
# File 'app/decorators/tenon/application_decorator.rb', line 5

def serializer_class
  "#{object.class}Serializer".safe_constantize
end