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