Class: Dsu::Presenters::EntryGroupPresenter

Inherits:
BasePresenter
  • Object
show all
Defined in:
lib/dsu/presenters/entry_group_presenter.rb

Instance Attribute Summary collapse

Attributes inherited from BasePresenter

#color_theme

Instance Method Summary collapse

Methods included from Support::ColorThemable

apply_theme, #prompt_with_options

Constructor Details

#initialize(entry_group, options: {}) ⇒ EntryGroupPresenter

Returns a new instance of EntryGroupPresenter.



11
12
13
14
15
# File 'lib/dsu/presenters/entry_group_presenter.rb', line 11

def initialize(entry_group, options: {})
  super

  @entry_group = entry_group
end

Instance Attribute Details

#entry_groupObject (readonly)

Returns the value of attribute entry_group.



9
10
11
# File 'lib/dsu/presenters/entry_group_presenter.rb', line 9

def entry_group
  @entry_group
end

Instance Method Details

#formatted_errorsObject



22
23
24
25
26
27
# File 'lib/dsu/presenters/entry_group_presenter.rb', line 22

def formatted_errors
  return if valid?

  colors = color_theme.error
  apply_theme(errors.full_messages.join(', '), theme_color: colors)
end

#formatted_timeObject



17
18
19
20
# File 'lib/dsu/presenters/entry_group_presenter.rb', line 17

def formatted_time
  colors = color_theme.date
  apply_theme(Support::TimeFormatable.formatted_time(time: time), theme_color: colors)
end

#no_entries_availableObject



29
30
31
32
# File 'lib/dsu/presenters/entry_group_presenter.rb', line 29

def no_entries_available
  header = I18n.t('presenters.entry_group_presenter.headers.no_entries_available')
  apply_theme(header, theme_color: color_theme.info)
end