forked from fixin.me/fixin.me
Back to single-select form w/ multiple select actions
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
module QuantitiesHelper
|
||||
def quantity_options(quantities, selected: nil)
|
||||
values = quantities.map { |q| [sanitize(' ' * q.depth + q.name), q.id] }
|
||||
values.unshift([t('.select_quantity'), nil, {hidden: true}])
|
||||
options_for_select(values, selected: selected)
|
||||
def quantity_option_text(quantity, checked = nil)
|
||||
prefix = case checked
|
||||
when true
|
||||
# Use color and gray unicode emoji to assure same width.
|
||||
# Avoid shapes similar to inputs (chackboxes, radio buttons etc.)
|
||||
# (U+27A1 U+FE0F)/U+1F7E6/U+2705/U+1F499 U+2004
|
||||
'💙 '
|
||||
when false
|
||||
# U+2B1C/U+1F90D U+2004
|
||||
'🤍 '
|
||||
else
|
||||
''
|
||||
end
|
||||
sanitize(' ' * quantity.depth + prefix + quantity.name)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user