Class: Decidim::Log::ValueTypes::AreaTypePresenter

Inherits:
DefaultPresenter show all
Defined in:
decidim-core/app/presenters/decidim/log/value_types/area_type_presenter.rb

Overview

This class presents the given value as a Decidim::AreaType. Check the `DefaultPresenter` for more info on how value presenters work.

Instance Method Summary collapse

Methods inherited from DefaultPresenter

#initialize

Constructor Details

This class inherits a constructor from Decidim::Log::ValueTypes::DefaultPresenter

Instance Method Details

#presentObject

Public: Presents the value as an AreaType. If the area type can be found, it shows its title. Otherwise it shows its ID.

Returns an HTML-safe String.


14
15
16
17
18
19
# File 'decidim-core/app/presenters/decidim/log/value_types/area_type_presenter.rb', line 14

def present
  return unless value
  return h.translated_attribute(area_type.name) if area_type

  I18n.t("not_found", id: value, scope: "decidim.log.value_types.area_type_presenter")
end