Sha256: 603af8574ef050d6cebc225daa10ec277817692dfebd6e5e348a3edcb94a3ccd

Contents?: true

Size: 652 Bytes

Versions: 5

Compression:

Stored size: 652 Bytes

Contents

# TODO: Refactor into OperableDecorator module
class ResourceDecorator < ApplicationDecorator
  def last_operation_gravatar
    garner.bind(h.controller.session_token).bind(object) do
      h.gravatar_url(last_operation.user.email, 32)
    end
  end

  def last_operation_summary
    garner.bind(h.controller.session_token).bind(object) do
      "#{last_operation.decorate.past_tense} " \
      "#{h.time_ago_in_words(last_operation.created_at)} ago"
    end
  end

  def last_operation
    object.operations.first
  end

  def operation_count
    garner.bind(h.controller.session_token).bind(object) do
      object.operations.count
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aptible-rails-0.4.12 lib/aptible/rails/decorators/resource_decorator.rb
aptible-rails-0.4.11 lib/aptible/rails/decorators/resource_decorator.rb
aptible-rails-0.4.10 lib/aptible/rails/decorators/resource_decorator.rb
aptible-rails-0.4.9 lib/aptible/rails/decorators/resource_decorator.rb
aptible-rails-0.4.8 lib/aptible/rails/decorators/resource_decorator.rb