Sha256: 1e6b2198e04121230f414a0a5690956a6cd69567c569a8db740289f4aed3e5b4
Contents?: true
Size: 1.1 KB
Versions: 69
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Decidim module Events # This module is used to be included in event classes inheriting from SimpleEvent # whose resource has an author. # # It adds the author_name, author_nickname, author_path and author_url to the i18n interpolations. module AuthorEvent extend ActiveSupport::Concern included do i18n_attributes :author_name, :author_nickname, :author_path, :author_url def author_nickname author_presenter&.nickname.to_s end def author_name author_presenter&.name.to_s end def author_path author_presenter&.profile_path.to_s end def author_url author_presenter&.profile_url.to_s end def author_presenter return unless author @author_presenter ||= Decidim::UserPresenter.new(author) end def author return unless resource.respond_to?(:author) return unless resource.author.is_a?(Decidim::UserBaseEntity) resource.author end end end end end
Version data entries
69 entries across 69 versions & 1 rubygems