From ccdd12bf597d27058f41de27932fe9e9f1249d9c Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Mon, 4 Aug 2025 14:24:04 +1000 Subject: [PATCH] Small improvment - add value for preferred customer tags - allow passing html options to preferred customer tags hidden field --- app/components/tag_rule_form_component.rb | 7 +++++-- .../tag_rule_form_component.html.haml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/components/tag_rule_form_component.rb b/app/components/tag_rule_form_component.rb index 6f5365e157..bcdb5b8aa1 100644 --- a/app/components/tag_rule_form_component.rb +++ b/app/components/tag_rule_form_component.rb @@ -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 diff --git a/app/components/tag_rule_form_component/tag_rule_form_component.html.haml b/app/components/tag_rule_form_component/tag_rule_form_component.html.haml index 867a433c67..1deec6be81 100644 --- a/app/components/tag_rule_form_component/tag_rule_form_component.html.haml +++ b/app/components/tag_rule_form_component/tag_rule_form_component.html.haml @@ -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