Sha256: c1be4871c60dc7b7d43af525676c52b9ebd1c620f6dde0558706be676a6f58e6

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::ActionDecorator < Tramway::ApplicationDecorator
  class << self
    delegate :human_action_state_event_name, to: :model_class
    delegate :human_attribute_name, to: :model_class
  end

  def name
    "#{object.title} - #{date_view(object.deadline)} - #{state_machine_view(object, :action_state)}"
  end

  def title
    object.title
  end

  def action_state_button_color(event)
    case event
    when :do
      :success
    when :decline
      :danger
    when :return
      :warning
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-event-2.0.1 app/decorators/tramway/event/action_decorator.rb
tramway-event-2.0.0.1 app/decorators/tramway/event/action_decorator.rb
tramway-event-2.0 app/decorators/tramway/event/action_decorator.rb