mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 15:35:22 +02:00
Remove action_type and needs_value now that controller is injecting templates/hiding action target
This commit is contained in:
parent
690daceba2
commit
d9a7f19bc1
2 changed files with 2 additions and 9 deletions
|
@ -25,11 +25,6 @@ export default class extends Controller {
|
|||
(executor) => executor.key === e.target.value,
|
||||
);
|
||||
|
||||
if (!actionExecutor || actionExecutor.needs_value === false) {
|
||||
this.#hideActionValue();
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear any existing input elements first
|
||||
this.#clearFormFields();
|
||||
|
||||
|
@ -38,7 +33,7 @@ export default class extends Controller {
|
|||
} else if (actionExecutor.type === "text") {
|
||||
this.#buildTextInputFor();
|
||||
} else {
|
||||
// For any type that doesn't need a value (e.g. function)
|
||||
// Hide for any type that doesn't need a value (e.g. function)
|
||||
this.#hideActionValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
<% action = form.object %>
|
||||
<% rule = action.rule %>
|
||||
<% action_type = action.executor.type %>
|
||||
<% needs_value = action.executor.type == "select" || action.executor.type == "text" %>
|
||||
|
||||
<li data-controller="rule--actions" data-rule--actions-action-executors-value="<%= rule.action_executors.to_json %>" class="flex items-center gap-3">
|
||||
<%= form.hidden_field :_destroy, value: false, data: { rule__actions_target: "destroyField" } %>
|
||||
|
@ -13,7 +11,7 @@
|
|||
<%= form.select :action_type, rule.action_executors.map { |executor| [ executor.label, executor.key ] }, {}, data: { action: "rule--actions#handleActionTypeChange" } %>
|
||||
</div>
|
||||
|
||||
<%= tag.div class: class_names("min-w-1/2 flex items-center gap-2", "hidden" => !needs_value),
|
||||
<%= tag.div class: class_names("min-w-1/2 flex items-center gap-2"),
|
||||
data: { rule__actions_target: "actionValue" } do %>
|
||||
<span class="font-medium uppercase text-xs" data-rule--actions-target="toSpan">to</span>
|
||||
<%# Initial rendering based on rule.action_executors.first from the rule form. %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue