Module: Isaca::Rails::ApplicationHelper

Defined in:
app/helpers/isaca/rails/application_helper.rb

Instance Method Summary collapse

Instance Method Details

Injects the isaca privacy policy and cookie consent notices



3
4
5
# File 'app/helpers/isaca/rails/application_helper.rb', line 3

def isaca_consent_javascript
  javascript_include_tag 'https://www.isaca.org/info/shared/js/isaca-consent.min.js'
end

#isaca_flash_messagesObject

Presents beautiful flash notices if flash notices exist



8
9
10
11
12
13
14
# File 'app/helpers/isaca/rails/application_helper.rb', line 8

def isaca_flash_messages
   :div do
    flash.collect do |name, message|
      concat( :div, message, class: "ir-flash ir-flash-#{name.underscore}")
    end
  end
end

#isaca_form_errors(model) ⇒ Object

Presents beautiful error messages for form objects



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/helpers/isaca/rails/application_helper.rb', line 17

def isaca_form_errors(model)
  if model.errors.size > 1
    message = 'The following errors occurred:'
  else
    message = 'The following error occurred:'
  end

  concat((:p, message))

   :div, class: 'ir-flash ir-flash-alert' do
    error_list =  (:ul) do
      model.errors.full_messages.collect do |message|
        concat( :li, message)
      end
    end

    concat(error_list)
  end
end

Provides a link to create an ISACA account



44
45
46
47
48
# File 'app/helpers/isaca/rails/application_helper.rb', line 44

def (**options)
  url = 'https://www.isaca.org/ecommerce/Pages/CreateAccountLite.aspx?pf=1'
  url.concat("&ReturnURL=#{Isaca::Rails.configuration.}") if Isaca::Rails.configuration.
  link_to 'Create ISACA Account', url, target: :blank, class: (options && options.has_key?(:class) ? options[:class] : '')
end

Provides a link to reset user credentials



38
39
40
41
# File 'app/helpers/isaca/rails/application_helper.rb', line 38

def link_to_forgot_isaca_credentials
  link_to 'Forgot password and/or username?',
          'https://www.isaca.org/ecommerce/Pages/Forgot-Password.aspx', target: :blank
end