Class: Tenon::ApplicationDecorator

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

Instance Method Summary collapse

Instance Method Details



17
18
19
# File 'app/decorators/tenon/application_decorator.rb', line 17

def delete_link(opts = {})
  h.delete_link(object, opts)
end


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

def edit_link(opts = {})
  h.edit_link(object, opts)
end

#edit_pathObject



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

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

#pathObject



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

def path
  h.url_for(object)
end

#published?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
# File 'app/decorators/tenon/application_decorator.rb', line 21

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