# frozen_string_literal: true module ApplicationHelper def experience_options val options_for_select([ ["Please select", ""], ["0-3 Years", "0-3"], ["4-6 Years", "4-6"], ["7-9 Years", "7-9"], ["10-14 Years", "10-14"], ["15+ Years", "15+"] ], disabled: "-", selected: (val.blank? ? '' : val)) end def quiz_options quizzes, selected_val options_from_collection_for_select(quizzes, 'id', 'name', selected_val) end def admin_role_options val options_for_select([ %w(Reviewer reviewer), %w(Recruiter recruiter), %w(Manager manager), %w(Admin admin) ], disabled: "-", selected: (val.blank? ? '' : val)) end def question_type_options val options_for_select([ %w(Text text), %w(Radio radio), ['Radio with other', 'radio_other'], %w(Checkbox checkbox), ['Checkbox with other', 'checkbox_other'], %w(Coder live_code) ], selected: (val.blank? ? '' : val)) end # include javascript only once # Allows the safe loading of js dependencies in partials multiple times. def content_for_javascript_once code_label, &block @js_blocks ||= [] return if @js_blocks.include? code_label @js_blocks << code_label content_for :custom_javascipt, &block end end