Sha256: eba09f8cb4730bb48a44c9a00518049968a580ec49ef82c076383086d805636e
Contents?: true
Size: 969 Bytes
Versions: 3
Compression:
Stored size: 969 Bytes
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 end def author_name author_presenter.name end def author_path author_presenter.profile_path end def author_url author_presenter.profile_url end def author_presenter @author ||= Decidim::UserPresenter.new(author) end def author resource.author if resource.respond_to?(:author) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.9.2 | lib/decidim/events/author_event.rb |
decidim-core-0.9.1 | lib/decidim/events/author_event.rb |
decidim-core-0.9.0 | lib/decidim/events/author_event.rb |