Module: Applicants::ApplicantsHelper

Included in:
ApplicantsController
Defined in:
app/helpers/applicants/applicants_helper.rb

Instance Method Summary collapse

Instance Method Details



21
22
23
24
25
# File 'app/helpers/applicants/applicants_helper.rb', line 21

def admin_navigation_link state
  link         = link_to state.capitalize, with_state_admin_applicants_path(state: state)
  active_class = viewing?(state) ? 'active' : ''
  (:li, link, class: active_class)
end

#current_translationsObject



4
5
6
7
# File 'app/helpers/applicants/applicants_helper.rb', line 4

def current_translations
  @translations ||= I18n.backend.send(:translations)
  @translations[I18n.locale].with_indifferent_access
end

#detect_user_operating_systemObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/helpers/applicants/applicants_helper.rb', line 47

def detect_user_operating_system
  case UseragentParser.parse(user_agent).os_family.try(:downcase)
    when /mac/
      :macintosh
    when /windows/
      :windows
    when /ios/
      :mobile
    when /android/
      :mobile
    else
      :unknown
  end
end

#icon(type, options = []) ⇒ Object



90
91
92
# File 'app/helpers/applicants/applicants_helper.rb', line 90

def icon(type, options=[])
  (:i, '', class: "icon-#{type} #{options.join(' ') if options.any?}")
end

#macintosh_activator_filenameObject



74
75
76
# File 'app/helpers/applicants/applicants_helper.rb', line 74

def macintosh_activator_filename
  racym(:applicants_activator_filename_macintosh)
end

#macintosh_activator_urlObject



70
71
72
# File 'app/helpers/applicants/applicants_helper.rb', line 70

def macintosh_activator_url
  "#{racym(:applicants_activator_download_base_url)}/#{macintosh_activator_filename}"
end

#macintosh_installer_urlObject



62
63
64
# File 'app/helpers/applicants/applicants_helper.rb', line 62

def macintosh_installer_url
  "#{racym(:applicants_orders_base_url)}/install-mac-recorder"
end

#macintosh_operating_system_user?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/helpers/applicants/applicants_helper.rb', line 35

def macintosh_operating_system_user?
  detect_user_operating_system == :macintosh
end

#mobile_operating_system_user?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/helpers/applicants/applicants_helper.rb', line 43

def mobile_operating_system_user?
  detect_user_operating_system == :mobile
end

#screen_recorder_descriptor_urlObject



31
32
33
# File 'app/helpers/applicants/applicants_helper.rb', line 31

def screen_recorder_descriptor_url
  Applicants::ScreencastOMatic::UrlBuilder.new(@applicant, request.host, request.port).descriptor_file_url
end

#stale_state(applicant) ⇒ Object



14
15
16
17
18
19
# File 'app/helpers/applicants/applicants_helper.rb', line 14

def stale_state(applicant)
  return unless applicant.reviewable?
  state = "stale" if applicant.stale?
  state = "very-stale" if applicant.very_stale?
  state
end

#test_exclude(&block) ⇒ Object



94
95
96
97
98
99
# File 'app/helpers/applicants/applicants_helper.rb', line 94

def test_exclude(&block)
  unless Rails.application.config.test_exclude
    yield
    return '' # http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/3ebf8c1ed79a9855
  end
end

#user_agentObject



86
87
88
# File 'app/helpers/applicants/applicants_helper.rb', line 86

def user_agent
  request.env['HTTP_USER_AGENT']
end

#video_transition_time_string(time) ⇒ Object



9
10
11
12
# File 'app/helpers/applicants/applicants_helper.rb', line 9

def video_transition_time_string(time)
  return nil unless time
  time.strftime('%m/%d/%Y %-I:%M%P')
end

#viewing?(state) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/helpers/applicants/applicants_helper.rb', line 27

def viewing? state
  @state and @state.to_s == state
end

#windows_activator_filenameObject



82
83
84
# File 'app/helpers/applicants/applicants_helper.rb', line 82

def windows_activator_filename
  racym(:applicants_activator_filename_windows)
end

#windows_activator_urlObject



78
79
80
# File 'app/helpers/applicants/applicants_helper.rb', line 78

def windows_activator_url
  "#{racym(:applicants_activator_download_base_url)}/#{windows_activator_filename}"
end

#windows_installer_urlObject



66
67
68
# File 'app/helpers/applicants/applicants_helper.rb', line 66

def windows_installer_url
  "#{racym(:applicants_orders_base_url)}/install-windows-recorder"
end

#windows_operating_system_user?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/helpers/applicants/applicants_helper.rb', line 39

def windows_operating_system_user?
  detect_user_operating_system == :windows
end