Module: EmulatorHelper

Defined in:
app/helpers/emulator_helper.rb

Instance Method Summary collapse

Instance Method Details

#check_roleObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/emulator_helper.rb', line 27

def check_role
  @role = nil
  @role = if current_user.eligible_sponsor?
            "Data Sponsor"
          elsif current_user.eligible_manager?
            "Data Manager"
          elsif current_user.eligible_data_user? && current_user.trainer == false
            "Data User"
          elsif current_user.sysadmin
            "System Administrator"
          else
            "Trainer"
          end
  @role
end

#emulator_contentObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/emulator_helper.rb', line 6

def emulator_content
  return if current_user.nil? || current_user.id.nil?
  @yaml_data = YAML.load_file("config/emulator.yml")
  return false if @yaml_data[Rails.env].nil? || @yaml_data[Rails.env] == "production"
  # return false unless current_page?("/")
  @emulator_title = @yaml_data[Rails.env]["title"]
  @emulator_body = @yaml_data[Rails.env]["body"]
  @emulator_alt_title = @yaml_data[Rails.env]["alt_title"]
  @emulator_alt_body = @yaml_data[Rails.env]["alt_body"]
  @absolute_user = User.find(current_user.id)
end

#homepage?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/helpers/emulator_helper.rb', line 18

def homepage?
  return true if current_page?("/")
end

#otherpage?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'app/helpers/emulator_helper.rb', line 22

def otherpage?
  @current_role = check_role
  return true unless current_page?("/")
end