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