Sha256: d09d048a03231321b6a90e77d894f0fa79a07bbe6b4b48154018a5ff67e36ef3
Contents?: true
Size: 854 Bytes
Versions: 2
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true module Decidim module Log module ValueTypes # This class presents the given value as a Decidim::ScopeType. Check # the `DefaultPresenter` for more info on how value # presenters work. class ScopeTypePresenter < DefaultPresenter # Public: Presents the value as a Percentage. If the scope can # be found, it shows its title. Otherwise it shows its ID. # # Returns an HTML-safe String. def present return unless value return h.translated_attribute(scope_type.name) if scope_type I18n.t("not_found", id: value, scope: "decidim.log.value_types.scope_type_presenter") end private def scope_type @scope_type ||= Decidim::ScopeType.where(id: value).first end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.10.1 | app/presenters/decidim/log/value_types/scope_type_presenter.rb |
decidim-core-0.10.0 | app/presenters/decidim/log/value_types/scope_type_presenter.rb |