skill-assessment-app/app/helpers/application_helper.rb
Mark Moser 4bbd93ded1 rubocop noise: fixes FrozenStringLiteralComment
Adding the .ruby-verison file triggered previously un-run cops, specifically:

  This cop is designed to help upgrade to Ruby 3.0. It will add the
  comment `# frozen_string_literal: true` to the top of files to enable
  frozen string literals. Frozen string literals will be default in Ruby
  3.0. The comment will be added below a shebang and encoding comment. The
  frozen string literal comment is only valid in Ruby 2.3+.

More info on rubocop [Automatic-Corrections](https://github.com/bbatsov/rubocop/wiki/Automatic-Corrections)
2016-09-08 10:30:13 -05:00

43 lines
1.5 KiB
Ruby

# 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 admin_role_options val
options_for_select([
%w(Reviewer reviewer),
%w(Recruiter recruiter),
%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