Module: TermsHelper

Defined in:
app/helpers/terms_helper.rb

Instance Method Summary collapse

Instance Method Details

#terms_data(terms, redirect) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/terms_helper.rb', line 4

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


21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/helpers/terms_helper.rb', line 21

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