Sha256: 8c1d788fa55368314bacbae38a882029f2ccf799948dc4c6627c23bf77612364
Contents?: true
Size: 856 Bytes
Versions: 65
Compression:
Stored size: 856 Bytes
Contents
# frozen_string_literal: true module Decidim module Log module ValueTypes # This class presents the given value as a Decidim::AssembliesType. Check # the `DefaultPresenter` for more info on how value # presenters work. class AssemblyTypePresenter < DefaultPresenter # Public: Presents the value as a Decidim::AssembliesType. If the type 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(type.title) if type I18n.t("not_found", id: value, scope: "decidim.log.value_types.assembly_type_presenter") end private def type @type ||= Decidim::AssembliesType.find_by(id: value) end end end end end
Version data entries
65 entries across 65 versions & 1 rubygems