Sha256: 1049f2961b0ae421535f04e6bd9ae008f4ec05a8e89bbfc0cd6aebf9a6fff793

Contents?: true

Size: 540 Bytes

Versions: 83

Compression:

Stored size: 540 Bytes

Contents

module Tenon
  class ApplicationDecorator < Draper::Decorator
    delegate_all

    def path
      h.url_for(object)
    end

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

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

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

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

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.1.8 app/decorators/tenon/application_decorator.rb
tenon-1.1.7 app/decorators/tenon/application_decorator.rb
tenon-1.1.6 app/decorators/tenon/application_decorator.rb
tenon-1.1.5 app/decorators/tenon/application_decorator.rb
tenon-1.1.4 app/decorators/tenon/application_decorator.rb
tenon-1.1.3 app/decorators/tenon/application_decorator.rb
tenon-1.1.2 app/decorators/tenon/application_decorator.rb
tenon-1.1.1 app/decorators/tenon/application_decorator.rb
tenon-1.0.76 app/decorators/tenon/application_decorator.rb
tenon-1.0.75 app/decorators/tenon/application_decorator.rb
tenon-1.0.74 app/decorators/tenon/application_decorator.rb
tenon-1.0.73 app/decorators/tenon/application_decorator.rb
tenon-1.0.72 app/decorators/tenon/application_decorator.rb
tenon-1.0.71 app/decorators/tenon/application_decorator.rb
tenon-1.0.70 app/decorators/tenon/application_decorator.rb
tenon-1.0.69 app/decorators/tenon/application_decorator.rb
tenon-1.0.68 app/decorators/tenon/application_decorator.rb
tenon-1.0.67 app/decorators/tenon/application_decorator.rb
tenon-1.0.66 app/decorators/tenon/application_decorator.rb
tenon-1.0.65 app/decorators/tenon/application_decorator.rb