Welcome to mirror list, hosted at ThFree Co, Russian Federation.

helper.rb « in_product_marketing « message « email « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cec0aad44a6b02ffc31a8a5a76d739b33a72e933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true

module Gitlab
  module Email
    module Message
      module InProductMarketing
        module Helper
          include ActionView::Context
          include ActionView::Helpers::TagHelper

          private

          def list(array)
            case format
            when :html
              tag.ul { array.map { |item| tag.li item} }
            else
              '- ' + array.join("\n- ")
            end
          end

          def strong_options
            case format
            when :html
              { strong_start: '<b>'.html_safe, strong_end: '</b>'.html_safe }
            else
              { strong_start: '', strong_end: '' }
            end
          end

          def link(text, link)
            case format
            when :html
              ActionController::Base.helpers.link_to text, link
            else
              "#{text} (#{link})"
            end
          end
        end
      end
    end
  end
end