skill-assessment-app/app/helpers/application_helper.rb

42 lines
1.4 KiB
Ruby
Raw Normal View History

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))
end
2016-08-18 18:22:57 -05:00
def admin_role_options val
options_for_select([
%w(Reviewer reviewer),
%w(Recruiter recruiter),
%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),
['Radio with other', 'radio_other'],
2016-08-19 16:02:18 -05:00
%w(Checkbox checkbox),
['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
2016-07-26 11:59:23 -05:00
end