1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 07:25:19 +02:00

Ensure the condition group "Add condition" button is type button to avoid form submission

This commit is contained in:
hatz 2025-05-09 19:44:21 -05:00
parent a268c5a563
commit fc64b00a5e
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

@ -44,6 +44,7 @@
text: "Add condition", text: "Add condition",
leading_icon: "plus", leading_icon: "plus",
variant: "ghost", variant: "ghost",
type: "button",
data: { action: "rule--conditions#addSubCondition" } data: { action: "rule--conditions#addSubCondition" }
) %> ) %>
</li> </li>

View file

@ -12,7 +12,7 @@
<section class="space-y-4"> <section class="space-y-4">
<h3 class="text-sm font-medium text-primary">If <%= rule.resource_type %></h3> <h3 class="text-sm font-medium text-primary">If <%= rule.resource_type %></h3>
<%# Condition template, used by Stimulus controller to add new conditions dynamically %> <%# Condition Group template, used by Stimulus controller to add new conditions dynamically %>
<template data-rules-target="conditionGroupTemplate"> <template data-rules-target="conditionGroupTemplate">
<%= f.fields_for :conditions, Rule::Condition.new(rule: rule, condition_type: "compound", operator: "and"), child_index: "IDX_PLACEHOLDER" do |cf| %> <%= f.fields_for :conditions, Rule::Condition.new(rule: rule, condition_type: "compound", operator: "and"), child_index: "IDX_PLACEHOLDER" do |cf| %>
<%= render "rule/conditions/condition_group", form: cf %> <%= render "rule/conditions/condition_group", form: cf %>