display small selects as radio buttons
This commit is contained in:
parent
debbb21440
commit
22fc4c4195
3 changed files with 19 additions and 4 deletions
|
@ -1,2 +1,3 @@
|
|||
class Champs::DropDownListChamp < Champ
|
||||
THRESHOLD_NB_OPTIONS_AS_RADIO = 3
|
||||
end
|
||||
|
|
|
@ -8,6 +8,10 @@ class DropDownList < ApplicationRecord
|
|||
result.blank? ? [] : [''] + result
|
||||
end
|
||||
|
||||
def enabled_non_empty_options
|
||||
(options - disabled_options).reject(&:empty?)
|
||||
end
|
||||
|
||||
def disabled_options
|
||||
options.filter { |v| (v =~ /^--.*--$/).present? }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue