Change the "Add condition" button in groups to type button to avoid form submission #2233

Merged
ahatzz11 merged 1 commits from fix-add-condition-submission into main 2025-05-13 22:35:24 +08:00
2 changed files with 2 additions and 1 deletions

View File

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

View File

@@ -12,7 +12,7 @@
<section class="space-y-4">
<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">
<%= 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 %>