File: terms_helper.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (35 lines) | stat: -rw-r--r-- 1,031 bytes parent folder | download
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
# frozen_string_literal: true

module TermsHelper
  def terms_data(terms, redirect)
    redirect_params = { redirect: redirect } if redirect

    {
      terms: markdown_field(terms, :terms),
      permissions: {
        can_accept: can?(current_user, :accept_terms, terms),
        can_decline: can?(current_user, :decline_terms, terms)
      },
      paths: {
        accept: accept_term_path(terms, redirect_params),
        decline: decline_term_path(terms, redirect_params),
        root: root_path
      }
    }.to_json
  end

  def terms_service_notice_link(button_text)
    terms_link = link_to('', terms_path, target: '_blank', rel: 'noopener noreferrer')

    safe_format(
      s_(
        'SignUp|By clicking %{button_text} or registering through a third party you accept the %{link_start}Terms ' \
          'of Use and acknowledge the Privacy Statement and Cookie Policy%{link_end}.'
      ),
      tag_pair(terms_link, :link_start, :link_end),
      button_text: button_text
    )
  end
end

TermsHelper.prepend_mod