Sha256: 2e48c0b72db0927be8450887e7d0572a3f9515bdee55957954a487566866849e

Contents?: true

Size: 1.24 KB

Versions: 31

Compression:

Stored size: 1.24 KB

Contents

# frozen-string_literal: true

module Decidim
  module Events
    # This module is used to be included in event classes (those inheriting from
    # `Decidim::Events::BaseEvent`) that need to send emails with the notification.
    #
    # This modules adds the needed logic to deliver emails to a given user.
    #
    # Example:
    #
    #   class MyEvent < Decidim::Events::BaseEvent
    #     include Decidim::Events::EmailEvent
    #   end
    module EmailEvent
      extend ActiveSupport::Concern

      included do
        type :email

        def email_subject
          I18n.t("decidim.events.email_event.email_subject", resource_title: resource_title)
        end

        def email_greeting
          I18n.t("decidim.events.email_event.email_greeting", user_name: user.name)
        end

        def email_intro
          I18n.t("decidim.events.email_event.email_intro", resource_title: resource_title)
        end

        def email_outro
          I18n.t("decidim.events.email_event.email_outro", resource_title: resource_title)
        end

        def has_button?
          button_text.present? && button_url.present?
        end

        def button_text
          nil
        end

        def button_url
          nil
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-core-0.27.9 lib/decidim/events/email_event.rb
decidim-core-0.27.8 lib/decidim/events/email_event.rb
decidim-core-0.27.7 lib/decidim/events/email_event.rb
decidim-core-0.27.6 lib/decidim/events/email_event.rb
decidim-core-0.26.10 lib/decidim/events/email_event.rb
decidim-core-0.26.9 lib/decidim/events/email_event.rb
decidim-core-0.27.5 lib/decidim/events/email_event.rb
decidim-core-0.26.8 lib/decidim/events/email_event.rb
decidim-core-0.27.4 lib/decidim/events/email_event.rb
decidim-core-0.27.3 lib/decidim/events/email_event.rb
decidim-core-0.26.7 lib/decidim/events/email_event.rb
decidim-core-0.26.5 lib/decidim/events/email_event.rb
decidim-core-0.27.2 lib/decidim/events/email_event.rb
decidim-core-0.27.1 lib/decidim/events/email_event.rb
decidim-core-0.26.4 lib/decidim/events/email_event.rb
decidim-core-0.27.0 lib/decidim/events/email_event.rb
decidim-core-0.26.3 lib/decidim/events/email_event.rb
decidim-core-0.27.0.rc2 lib/decidim/events/email_event.rb
decidim-core-0.27.0.rc1 lib/decidim/events/email_event.rb
decidim-core-0.26.2 lib/decidim/events/email_event.rb