Sha256: 11d1b2f7d1d189d53775dcd44ecf4859ca8823f5c0d95375744760e6979f89eb

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

# frozen-string_literal: true

module Decidim
  module Initiatives
    class EndorseInitiativeEvent < Decidim::Events::BaseEvent
      include Decidim::Events::EmailEvent
      include Decidim::Events::NotificationEvent

      def email_subject
        I18n.t(
          "decidim.initiatives.events.endorse_initiative_event.email_subject",
          resource_title: resource_title,
          author_nickname: author.nickname,
          author_name: author.name
        )
      end

      def email_intro
        I18n.t(
          "decidim.initiatives.events.endorse_initiative_event.email_intro",
          resource_title: resource_title,
          author_nickname: author.nickname,
          author_name: author.name
        )
      end

      def email_outro
        I18n.t(
          "decidim.initiatives.events.endorse_initiative_event.email_outro",
          resource_title: resource_title,
          author_nickname: author.nickname,
          author_name: author.name
        )
      end

      def notification_title
        I18n.t(
          "decidim.initiatives.events.endorse_initiative_event.notification_title",
          resource_title: resource_title,
          resource_path: resource_path,
          author_nickname: author.nickname,
          author_name: author.name,
          author_path: author.profile_path
        ).html_safe
      end

      private

      def author
        @author ||= Decidim::UserPresenter.new(resource.author)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-initiatives-0.11.2 app/events/decidim/initiatives/endorse_initiative_event.rb
decidim-initiatives-0.11.1 app/events/decidim/initiatives/endorse_initiative_event.rb
decidim-initiatives-0.11.0.pre1 app/events/decidim/initiatives/endorse_initiative_event.rb
decidim-initiatives-0.9.1 app/events/decidim/initiatives/endorse_initiative_event.rb