Module: Applicants::ApplicantsHelper
- Included in:
- ApplicantsController
- Defined in:
- app/helpers/applicants/applicants_helper.rb
Instance Method Summary collapse
- #admin_navigation_link(state) ⇒ Object
- #current_translations ⇒ Object
- #detect_user_operating_system ⇒ Object
- #icon(type, options = []) ⇒ Object
- #macintosh_activator_filename ⇒ Object
- #macintosh_activator_url ⇒ Object
- #macintosh_installer_url ⇒ Object
- #macintosh_operating_system_user? ⇒ Boolean
- #mobile_operating_system_user? ⇒ Boolean
- #screen_recorder_descriptor_url ⇒ Object
- #stale_state(applicant) ⇒ Object
- #test_exclude(&block) ⇒ Object
- #user_agent ⇒ Object
- #video_transition_time_string(time) ⇒ Object
- #viewing?(state) ⇒ Boolean
- #windows_activator_filename ⇒ Object
- #windows_activator_url ⇒ Object
- #windows_installer_url ⇒ Object
- #windows_operating_system_user? ⇒ Boolean
Instance Method Details
#admin_navigation_link(state) ⇒ Object
21 22 23 24 25 |
# File 'app/helpers/applicants/applicants_helper.rb', line 21 def state link = link_to state.capitalize, with_state_admin_applicants_path(state: state) active_class = viewing?(state) ? 'active' : '' content_tag(:li, link, class: active_class) end |
#current_translations ⇒ Object
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_system ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/applicants/applicants_helper.rb', line 47 def 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, =[]) content_tag(:i, '', class: "icon-#{type} #{.join(' ') if .any?}") end |
#macintosh_activator_filename ⇒ Object
74 75 76 |
# File 'app/helpers/applicants/applicants_helper.rb', line 74 def macintosh_activator_filename racym(:applicants_activator_filename_macintosh) end |
#macintosh_activator_url ⇒ Object
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_url ⇒ Object
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
35 36 37 |
# File 'app/helpers/applicants/applicants_helper.rb', line 35 def == :macintosh end |
#mobile_operating_system_user? ⇒ Boolean
43 44 45 |
# File 'app/helpers/applicants/applicants_helper.rb', line 43 def == :mobile end |
#screen_recorder_descriptor_url ⇒ Object
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_agent ⇒ Object
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
27 28 29 |
# File 'app/helpers/applicants/applicants_helper.rb', line 27 def viewing? state @state and @state.to_s == state end |
#windows_activator_filename ⇒ Object
82 83 84 |
# File 'app/helpers/applicants/applicants_helper.rb', line 82 def windows_activator_filename racym(:applicants_activator_filename_windows) end |
#windows_activator_url ⇒ Object
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_url ⇒ Object
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
39 40 41 |
# File 'app/helpers/applicants/applicants_helper.rb', line 39 def == :windows end |