Small improvment

- add value for preferred customer tags
- allow passing html options to preferred customer tags hidden field
This commit is contained in:
Gaetan Craig-Riou
2025-08-04 14:24:04 +10:00
parent b66b033999
commit ccdd12bf59
2 changed files with 6 additions and 3 deletions

View File

@@ -1,13 +1,16 @@
# frozen_string_literal: true
class TagRuleFormComponent < ViewComponent::Base
def initialize(rule:, rule_data:, index:)
def initialize(rule:, rule_data:, index:, customer_tags: "",
hidden_field_customer_tag_options: {})
@rule = rule
@rule_data = rule_data
@index = index
@customer_tags = customer_tags
@hidden_field_customer_tag_options = hidden_field_customer_tag_options
end
attr_reader :rule, :index, :rule_data
attr_reader :rule, :index, :rule_data, :customer_tags, :hidden_field_customer_tag_options
private

View File

@@ -10,7 +10,7 @@
= hidden_field_tag element_name("type"), rule.type
= hidden_field_tag element_name("priority"), index
= hidden_field_tag element_name("is_default"), rule.is_default
= hidden_field_tag element_name("preferred_customer_tags")
= hidden_field_tag element_name("preferred_customer_tags"), customer_tags, hidden_field_customer_tag_options
%span.text-normal
= rule_data[:text_top]
%td