Back to single-select form w/ multiple select actions

This commit is contained in:
2025-08-17 01:03:08 +02:00
parent 46dd480b4e
commit 207699584b
14 changed files with 85 additions and 53 deletions

View File

@@ -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