Simplify column toggling in report spec

* This partly reverts 3a957fb988.
This commit is contained in:
Maikel Linke
2024-01-04 16:53:36 +11:00
parent dcc962a8fd
commit 883bfcdf0d
4 changed files with 12 additions and 22 deletions

View File

@@ -1,11 +1,7 @@
# frozen_string_literal: true
class MultipleCheckedSelectComponent < ViewComponent::Base
# @param id [String]
# Uniquely identifies the MultipleCheckedSelect (mcs) field.
# '_mcs_field' will be appended to the given ID to form the complete ID.
def initialize(id:, name:, options:, selected:)
@id = "#{id}_mcs_field"
def initialize(name:, options:, selected:)
@name = name
@options = options.map { |option| [option[0], option[1].to_sym] }
@selected = selected.nil? ? [] : selected.map(&:to_sym)