Sha256: 392fa0d7ae887928bdf83015443662fb17a46034318d4b18cc3cf47bd0021287

Contents?: true

Size: 1.42 KB

Versions: 7

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

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

      def email_subject
        I18n.t(
          "decidim.initiatives.events.spawn_committee_request_event.email_subject",
          applicant_nickname:
        )
      end

      def email_intro
        I18n.t(
          "decidim.initiatives.events.spawn_committee_request_event.email_intro",
          resource_title:,
          resource_url:,
          applicant_profile_url:,
          applicant_nickname:
        )
      end

      def email_outro
        I18n.t(
          "decidim.initiatives.events.spawn_committee_request_event.email_outro",
          resource_title:,
          resource_url:
        )
      end

      def notification_title
        I18n.t(
          "decidim.initiatives.events.spawn_committee_request_event.notification_title",
          resource_title:,
          resource_url:,
          applicant_profile_url:,
          applicant_nickname:
        ).html_safe
      end

      private

      def applicant_nickname
        applicant.nickname
      end

      def applicant_profile_url
        applicant.profile_url
      end

      def applicant
        @applicant ||= Decidim::UserPresenter.new(
          Decidim::User.find(@extra["applicant"]["id"])
        )
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-initiatives-0.28.4 app/events/decidim/initiatives/spawn_committee_request_event.rb
decidim-initiatives-0.28.3 app/events/decidim/initiatives/spawn_committee_request_event.rb
decidim-initiatives-0.28.2 app/events/decidim/initiatives/spawn_committee_request_event.rb
decidim-initiatives-0.28.1 app/events/decidim/initiatives/spawn_committee_request_event.rb
decidim-initiatives-0.28.0 app/events/decidim/initiatives/spawn_committee_request_event.rb
decidim-initiatives-0.28.0.rc5 app/events/decidim/initiatives/spawn_committee_request_event.rb
decidim-initiatives-0.28.0.rc4 app/events/decidim/initiatives/spawn_committee_request_event.rb