mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Rename stimulus controller based on the new shorter naming
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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" })
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -69,7 +69,8 @@ describe("TagListInputController", () => {
|
||||
id="variant_add_tag"
|
||||
placeholder="Add a tag"
|
||||
data-action="keydown.enter->tag-list-input#addTag keyup->tag-list-input#filterInput" data-tag-list-input-target="newTag"
|
||||
>
|
||||
style="display: block;"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -144,25 +145,25 @@ describe("TagListInputController", () => {
|
||||
// Tag input with non existing tag
|
||||
document.body.innerHTML = `
|
||||
<div
|
||||
data-controller="tag-list-input-component--tag-list-input"
|
||||
data-tag-list-input-component--tag-list-input-only-one-value="true"
|
||||
data-controller="tag-list-input"
|
||||
data-tag-list-input-only-one-value="true"
|
||||
>
|
||||
<input
|
||||
value=""
|
||||
data-tag-list-input-component--tag-list-input-target="tagList"
|
||||
data-tag-list-input-target="tagList"
|
||||
type="hidden"
|
||||
name="variant_tag_list" id="variant_tag_list"
|
||||
>
|
||||
<div class="tags-input">
|
||||
<div class="tags">
|
||||
<ul class="tag-list" data-tag-list-input-component--tag-list-input-target="list">
|
||||
<template data-tag-list-input-component--tag-list-input-target="template">
|
||||
<ul class="tag-list" data-tag-list-input-target="list">
|
||||
<template data-tag-list-input-target="template">
|
||||
<li class="tag-item">
|
||||
<div class="tag-template">
|
||||
<span></span>
|
||||
<a
|
||||
class="remove-button"
|
||||
data-action="click->tag-list-input-component--tag-list-input#removeTag"
|
||||
data-action="click->tag-list-input#removeTag"
|
||||
>✖</a>
|
||||
</div>
|
||||
</li>
|
||||
@@ -173,7 +174,7 @@ describe("TagListInputController", () => {
|
||||
name="variant_add_tag"
|
||||
id="variant_add_tag"
|
||||
placeholder="Add a tag"
|
||||
data-action="keydown.enter->tag-list-input-component--tag-list-input#addTag keyup->tag-list-input-component--tag-list-input#filterInput" data-tag-list-input-component--tag-list-input-target="newTag"
|
||||
data-action="keydown.enter->tag-list-input#addTag keyup->tag-list-input#filterInput" data-tag-list-input-target="newTag"
|
||||
style="display: block;"
|
||||
>
|
||||
</div>
|
||||
@@ -211,25 +212,25 @@ describe("TagListInputController", () => {
|
||||
// Tag input with one existing tag
|
||||
document.body.innerHTML = `
|
||||
<div
|
||||
data-controller="tag-list-input-component--tag-list-input"
|
||||
data-tag-list-input-component--tag-list-input-only-one-value="true"
|
||||
data-controller="tag-list-input"
|
||||
data-tag-list-input-only-one-value="true"
|
||||
>
|
||||
<input
|
||||
value=""
|
||||
data-tag-list-input-component--tag-list-input-target="tagList"
|
||||
data-tag-list-input-target="tagList"
|
||||
type="hidden"
|
||||
name="variant_tag_list" id="variant_tag_list"
|
||||
>
|
||||
<div class="tags-input">
|
||||
<div class="tags">
|
||||
<ul class="tag-list" data-tag-list-input-component--tag-list-input-target="list">
|
||||
<template data-tag-list-input-component--tag-list-input-target="template">
|
||||
<ul class="tag-list" data-tag-list-input-target="list">
|
||||
<template data-tag-list-input-target="template">
|
||||
<li class="tag-item">
|
||||
<div class="tag-template">
|
||||
<span></span>
|
||||
<a
|
||||
class="remove-button"
|
||||
data-action="click->tag-list-input-component--tag-list-input#removeTag"
|
||||
data-action="click->tag-list-input#removeTag"
|
||||
>✖</a>
|
||||
</div>
|
||||
</li>
|
||||
@@ -239,7 +240,7 @@ describe("TagListInputController", () => {
|
||||
<span>tag 1</span>
|
||||
<a
|
||||
class="remove-button"
|
||||
data-action="click->tag-list-input-component--tag-list-input#removeTag"
|
||||
data-action="click->tag-list-input#removeTag"
|
||||
>✖</a>
|
||||
</div>
|
||||
</li>
|
||||
@@ -249,7 +250,7 @@ describe("TagListInputController", () => {
|
||||
name="variant_add_tag"
|
||||
id="variant_add_tag"
|
||||
placeholder="Add a tag"
|
||||
data-action="keydown.enter->tag-list-input-component--tag-list-input#addTag keyup->tag-list-input-component--tag-list-input#filterInput" data-tag-list-input-component--tag-list-input-target="newTag"
|
||||
data-action="keydown.enter->tag-list-input#addTag keyup->tag-list-input#filterInput" data-tag-list-input-target="newTag"
|
||||
style="display: none;"
|
||||
>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user