Class: Gitlab::Email::Message::InProductMarketing::Base

Inherits:
Object
  • Object
show all
Includes:
Helper, Gitlab::Experiment::Dsl, Routing
Defined in:
lib/gitlab/email/message/in_product_marketing/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Methods included from Helper

#address, #footer_links, #unsubscribe_message

Constructor Details

#initialize(group:, user:, series:, format: :html) ⇒ Base

Returns a new instance of Base.


14
15
16
17
18
19
20
21
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 14

def initialize(group:, user:, series:, format: :html)
  @series = series
  @group = group
  @user = user
  @format = format

  validate_series!
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.


12
13
14
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 12

def format
  @format
end

Instance Method Details

#body_line1Object

Raises:

  • (NotImplementedError)

39
40
41
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 39

def body_line1
  raise NotImplementedError
end

#body_line2Object

Raises:

  • (NotImplementedError)

43
44
45
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 43

def body_line2
  raise NotImplementedError
end

51
52
53
54
55
56
57
58
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 51

def cta_link
  case format
  when :html
    ActionController::Base.helpers.link_to cta_text, group_email_campaigns_url(group, track: track, series: series), target: '_blank', rel: 'noopener noreferrer'
  else
    [cta_text, group_email_campaigns_url(group, track: track, series: series)].join(' >> ')
  end
end

#cta_textObject

Raises:

  • (NotImplementedError)

47
48
49
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 47

def cta_text
  raise NotImplementedError
end

68
69
70
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 68

def invite_link
  action_link(s_('InProductMarketing|Invite them to help out.'), group_url(group, open_modal: 'invite_members_for_task'))
end

#invite_members?Boolean

Returns:

  • (Boolean)

60
61
62
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 60

def invite_members?
  false
end

#invite_textObject


64
65
66
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 64

def invite_text
  s_('InProductMarketing|Do you have a teammate who would be perfect for this task?')
end

#logo_pathObject


85
86
87
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 85

def logo_path
  ["mailers/in_product_marketing", "#{track}-#{series}.png"].join('/')
end

#progress(current: series + 1, total: total_series, track_name: track.to_s.humanize) ⇒ Object


77
78
79
80
81
82
83
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 77

def progress(current: series + 1, total: total_series, track_name: track.to_s.humanize)
  if Gitlab.com?
    s_('InProductMarketing|This is email %{current_series} of %{total_series} in the %{track} series.') % { current_series: current, total_series: total, track: track_name }
  else
    s_('InProductMarketing|This is email %{current_series} of %{total_series} in the %{track} series. To disable notification emails sent by your local GitLab instance, either contact your administrator or %{unsubscribe_link}.') % { current_series: current, total_series: total, track: track_name, unsubscribe_link: unsubscribe_link }
  end
end

#series?Boolean

Returns:

  • (Boolean)

89
90
91
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 89

def series?
  total_series > 0
end

#subject_lineObject

Raises:

  • (NotImplementedError)

23
24
25
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 23

def subject_line
  raise NotImplementedError
end

#subtitleObject

Raises:

  • (NotImplementedError)

35
36
37
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 35

def subtitle
  raise NotImplementedError
end

#taglineObject

Raises:

  • (NotImplementedError)

27
28
29
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 27

def tagline
  raise NotImplementedError
end

#titleObject

Raises:

  • (NotImplementedError)

31
32
33
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 31

def title
  raise NotImplementedError
end

#unsubscribeObject


72
73
74
75
# File 'lib/gitlab/email/message/in_product_marketing/base.rb', line 72

def unsubscribe
  self_managed_preferences_link = marketing_preference_link(track, series)
  unsubscribe_message(self_managed_preferences_link)
end