2016-09-08 10:25:33 -05:00
|
|
|
# frozen_string_literal: true
|
2016-07-26 11:59:23 -05:00
|
|
|
module ApplicationHelper
|
2016-07-31 14:47:15 -05:00
|
|
|
def experience_options val
|
|
|
|
options_for_select([
|
2016-08-04 08:51:54 -05:00
|
|
|
["Please select", ""],
|
2016-07-31 14:47:15 -05:00
|
|
|
["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))
|
2016-09-16 11:36:48 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def quiz_options quizzes, selected_val
|
|
|
|
options_from_collection_for_select(quizzes, 'id', 'name', selected_val)
|
2016-07-31 14:47:15 -05:00
|
|
|
end
|
2016-08-18 18:22:57 -05:00
|
|
|
|
|
|
|
def admin_role_options val
|
|
|
|
options_for_select([
|
|
|
|
%w(Reviewer reviewer),
|
|
|
|
%w(Recruiter recruiter),
|
2016-09-19 12:59:12 -05:00
|
|
|
%w(Manager manager),
|
2016-08-18 18:22:57 -05:00
|
|
|
%w(Admin admin)
|
|
|
|
], disabled: "-", selected: (val.blank? ? '' : val))
|
|
|
|
end
|
2016-08-19 16:02:18 -05:00
|
|
|
|
|
|
|
def question_type_options val
|
|
|
|
options_for_select([
|
|
|
|
%w(Text text),
|
|
|
|
%w(Radio radio),
|
2016-08-31 16:59:25 -05:00
|
|
|
['Radio with other', 'radio_other'],
|
2016-08-19 16:02:18 -05:00
|
|
|
%w(Checkbox checkbox),
|
2016-08-31 16:59:25 -05:00
|
|
|
['Checkbox with other', 'checkbox_other'],
|
2016-08-19 16:02:18 -05:00
|
|
|
%w(Coder live_code)
|
|
|
|
], selected: (val.blank? ? '' : val))
|
|
|
|
end
|
2016-09-07 17:45:22 -05:00
|
|
|
|
|
|
|
# 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
|
2017-02-14 16:39:53 -06:00
|
|
|
|
|
|
|
def sortable(column, title = nil)
|
|
|
|
title ||= column.titleize
|
|
|
|
css_class = column == sort_column ? sort_direction.to_s : nil
|
|
|
|
direction = column == sort_column && sort_direction == "desc" ? "asc" : "desc"
|
|
|
|
link_to title, { sort: column, direction: direction }, class: css_class
|
|
|
|
end
|
2016-07-26 11:59:23 -05:00
|
|
|
end
|