Sha256: 8412ac75145108803f36754dc5e52c2feb5fef2258a16ec13a2a92e83500f475

Contents?: true

Size: 908 Bytes

Versions: 13

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # To be used by UserGroup related events that trigger a notification to the administrators.
  class UserGroupAdminEvent < Decidim::Events::SimpleEvent
    delegate :url_helpers, to: "Decidim::Core::Engine.routes"

    i18n_attributes :user_group_name, :groups_admin_url, :groups_admin_path

    def resource_path
      url_helpers.profile_path(user_group_nickname)
    end

    def resource_url
      url_helpers.profile_url(
        user_group_nickname,
        host: user.organization.host
      )
    end

    def groups_admin_path
      Decidim::Admin::Engine.routes.url_helpers.user_groups_path
    end

    def groups_admin_url
      Decidim::Admin::Engine.routes.url_helpers.user_groups_url(host: user.organization.host)
    end

    def user_group_name
      resource.name
    end

    def user_group_nickname
      resource.nickname
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.4 app/events/decidim/user_group_admin_event.rb
decidim-core-0.29.0 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.3 app/events/decidim/user_group_admin_event.rb
decidim-core-0.29.0.rc4 app/events/decidim/user_group_admin_event.rb
decidim-core-0.29.0.rc3 app/events/decidim/user_group_admin_event.rb
decidim-core-0.29.0.rc2 app/events/decidim/user_group_admin_event.rb
decidim-core-0.29.0.rc1 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.2 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.1 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.0 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.0.rc5 app/events/decidim/user_group_admin_event.rb
decidim-core-0.28.0.rc4 app/events/decidim/user_group_admin_event.rb