Sha256: 91e9b45064fff3997c9d8a51b2a1e7326e846e24b5c1bf6d835ca9cb561d2b72

Contents?: true

Size: 702 Bytes

Versions: 6

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

class Tramway::SportSchool::TrainerDecorator < ::Tramway::Core::ApplicationDecorator
  class << self
    def collections
      [:all]
    end

    def list_attributes
      [:view_state]
    end
  end

  def full_name
    "#{object.first_name} #{object.patronymic} #{object.last_name}"
  end

  def initial_short_name
    "#{object.last_name} #{object.first_name[0]}. #{object.patronymic[0]}."
  end

  alias title full_name

  delegate_attributes :photo, :degree, :description

  def view_state
    object.human_view_state_name
  end

  def view_state_button_color(event)
    case event
    when :publish
      :primary
    when :hide
      :secondary
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tramway-sport_school-1.2.12.6 app/decorators/tramway/sport_school/trainer_decorator.rb
tramway-sport_school-1.2.12.5 app/decorators/tramway/sport_school/trainer_decorator.rb
tramway-sport_school-1.2.12.4 app/decorators/tramway/sport_school/trainer_decorator.rb
tramway-sport_school-1.2.12.3 app/decorators/tramway/sport_school/trainer_decorator.rb
tramway-sport_school-1.2.12.2 app/decorators/tramway/sport_school/trainer_decorator.rb
tramway-sport_school-1.2.12.1 app/decorators/tramway/sport_school/trainer_decorator.rb