Rename stimulus controller based on the new shorter naming

This commit is contained in:
Gaetan Craig-Riou
2025-09-22 15:29:36 +10:00
parent bc1823e276
commit c2c2a9503c
4 changed files with 33 additions and 32 deletions

View File

@@ -6,26 +6,26 @@
%div{ id: @id, "data-controller": @data_controller, "data-action": @data_action, "data-modal-instant-value": @instant, **@options }
.reveal-modal-bg.fade{ "data-modal-target": "background", "data-action": "click->modal#close" }
.reveal-modal.fade.modal-component{ "data-modal-target": "modal", class: @modal_class }
#new-tag-rule-dialog{ "data-controller": "add-tag-rule-modal-component--add-tag-rule-modal",
"data-add-tag-rule-modal-component--add-tag-rule-modal-index-value": current_index }
#new-tag-rule-dialog{ "data-controller": "add-tag-rule-modal",
"data-add-tag-rule-modal-index-value": current_index }
-# Ideally we would use event to communicate the update of customer tag, but we would need
-# the element with "data-controller": "add-tag-rule-modal-component--add-tag-rule-modal"
-# to be parent of the element with "data-controller": "tag-rule-group-form-component--tag-rule-group-form"
-# so it could respond to event generated by "tag-rule-group-form-component--tag-rule-group-form".
-# the element with "data-controller": "add-tag-rule-modal"
-# to be parent of the element with "data-controller": "tag-rule-group-form"
-# so it could respond to event generated by "tag-rule-group-form".
-# Here we are in the opposite situation so we use a hidden field to store the value of
-# the customer tag, so it can be updated by "tag-rule-group-form-component--tag-rule-group-form"
= hidden_field_tag "customer_tag", customer_tag, { "data-add-tag-rule-modal-component--add-tag-rule-modal-target": "ruleCustomerTag" }.merge(hidden_field_customer_tag_options)
-# the customer tag, so it can be updated by "tag-rule-group-form"
= hidden_field_tag "customer_tag", customer_tag, { "data-add-tag-rule-modal-target": "ruleCustomerTag" }.merge(hidden_field_customer_tag_options)
.text-normal.margin-bottom-30.text-center
= t('components.add_tag_rule_modal.select_rule_type')
.text-center.margin-bottom-30
= select_tag :rule_type_selector, options_for_select(tag_rule_types), { "data-controller": "tom-select", "data-add-tag-rule-modal-component--add-tag-rule-modal-target": "rule", class: "primary no-search" }
= select_tag :rule_type_selector, options_for_select(tag_rule_types), { "data-controller": "tom-select", "data-add-tag-rule-modal-target": "rule", class: "primary no-search" }
.text-center
%input.button.red.icon-plus{ type: 'button',
value: "#{t('components.add_tag_rule_modal.add_rule')}",
"data-action": "click->add-tag-rule-modal-component--add-tag-rule-modal#add click->modal#close",
"data-add-tag-rule-modal-component--add-tag-rule-modal-div-id-param": div_id,
"data-add-tag-rule-modal-component--add-tag-rule-modal-is-default-param": "#{is_default}"}
"data-action": "click->add-tag-rule-modal#add click->modal#close",
"data-add-tag-rule-modal-div-id-param": div_id,
"data-add-tag-rule-modal-is-default-param": "#{is_default}"}
- if close_button?
.text-center

View File

@@ -1,4 +1,4 @@
%div{ id: form_id, "data-controller": "tag-rule-group-form-component--tag-rule-group-form"}
%div{ id: form_id, "data-controller": "tag-rule-group-form" }
- rule_index = customer_rule_index
.customer_tag
.header
@@ -14,7 +14,7 @@
= render(TagListInputComponent.new(name: tag_list_input_name,
tags: group[:tags],
only_one: true,
hidden_field_data_options: { "data-action": "input->tag-rule-group-form-component--tag-rule-group-form#updatePreferredCustomerTag", "data-tag-rule-group-form-component--tag-rule-group-form-target": "customerTag" }))
hidden_field_data_options: { "data-action": "input->tag-rule-group-form#updatePreferredCustomerTag", "data-tag-rule-group-form-target": "customerTag" }))
%div{ id: customer_tag_rule_div_id }
- if group[:rules].empty?
.no_rules
@@ -25,7 +25,7 @@
= render(TagRuleFormComponent.new(rule: rule,
index: rule_index,
customer_tags: group[:tags],
hidden_field_customer_tag_options: { "data-tag-rule-group-form-component--tag-rule-group-form-target": "ruleCustomerTag" }))
hidden_field_customer_tag_options: { "data-tag-rule-group-form-target": "ruleCustomerTag" }))
%hr
.add_rule.text-center
@@ -36,4 +36,4 @@
current_index: (rule_index + 1),
div_id: customer_tag_rule_div_id,
customer_tag: group[:tags],
hidden_field_customer_tag_options: { "data-tag-rule-group-form-component--tag-rule-group-form-target": "ruleCustomerTag" })
hidden_field_customer_tag_options: { "data-tag-rule-group-form-target": "ruleCustomerTag" })

View File

@@ -6,5 +6,5 @@
= render(TagRuleFormComponent.new(rule: @default_rule,
index: @index,
customer_tags: @customer_tags,
hidden_field_customer_tag_options: { "data-tag-rule-group-form-component--tag-rule-group-form-target": "ruleCustomerTag" }))
hidden_field_customer_tag_options: { "data-tag-rule-group-form-target": "ruleCustomerTag" }))
= turbo_stream.remove_all ".no_rules"