Class: Decidim::InvitedToGroupEvent

Inherits:
Events::SimpleEvent show all
Defined in:
app/events/decidim/invited_to_group_event.rb

Instance Method Summary collapse

Methods inherited from Events::SimpleEvent

#email_intro, #email_outro, #email_subject, #event_has_roles?, i18n_attributes, #i18n_options, #i18n_scope, #notification_title, #participatory_space_url, #resource_text

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#default_locale?

Methods included from ComponentPathHelper

#can_be_managed?, #main_component_path, #main_component_url, #manage_component_path

Methods inherited from Events::BaseEvent

#content_in_same_language?, #hidden_resource?, #initialize, #organization, #perform_translation?, #resource_locator, #resource_text, #resource_title, #safe_resource_text, #safe_resource_translated_text, #translation_missing?, type

Methods included from SanitizeHelper

#decidim_escape_translated, #decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included

Constructor Details

This class inherits a constructor from Decidim::Events::BaseEvent

Instance Method Details

#action_cellObject



41
42
43
# File 'app/events/decidim/invited_to_group_event.rb', line 41

def action_cell
  "decidim/notification_actions/buttons" if invitation
end

#action_dataObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/events/decidim/invited_to_group_event.rb', line 45

def action_data
  [
    {
      url: url_helpers.group_invite_path(user_group_nickname, membership_id, format: :json),
      icon: "check-line",
      method: "patch",
      i18n_label: "decidim.group_invites.accept_invitation"
    },
    {
      url: url_helpers.group_invite_path(user_group_nickname, membership_id, format: :json),
      icon: "close-circle-line",
      method: "delete",
      i18n_label: "decidim.group_invites.reject_invitation"
    }
  ]
end

#groups_profile_tab_pathObject



21
22
23
# File 'app/events/decidim/invited_to_group_event.rb', line 21

def groups_profile_tab_path
  url_helpers.profile_groups_path(user.nickname)
end

#invitationObject



37
38
39
# File 'app/events/decidim/invited_to_group_event.rb', line 37

def invitation
  @invitation ||= UserGroupMembership.find_by(user:, id: membership_id, role: "invited")
end

#membership_idObject



33
34
35
# File 'app/events/decidim/invited_to_group_event.rb', line 33

def membership_id
  extra["membership_id"]
end

#resource_pathObject



17
18
19
# File 'app/events/decidim/invited_to_group_event.rb', line 17

def resource_path
  url_helpers.profile_path(user_group_nickname)
end

#resource_urlObject



10
11
12
13
14
15
# File 'app/events/decidim/invited_to_group_event.rb', line 10

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

#user_group_nameObject



29
30
31
# File 'app/events/decidim/invited_to_group_event.rb', line 29

def user_group_name
  extra["user_group_name"]
end

#user_group_nicknameObject



25
26
27
# File 'app/events/decidim/invited_to_group_event.rb', line 25

def user_group_nickname
  extra["user_group_nickname"]
end