Files
sure/app/views/rule/conditions/_condition_group.html.erb
Guilherme Mena 210b89cd17 Improve dark mode styles across multiple pages (#2125)
* fix: improve dark mode readability across the app

* fix: improve dark mode support for asset percentage text

* fix: apply suggested patch for theme-related improvements

* chore: apply PR feedback – remove dark:, align with design tokens, update form builder

* chore: revert background token and restore original style for visual consistency

* chore: remove unnecessary class attributes from form fields using builder

* refactor: move number_field and date_field into metaprogramming block

* refactor: replace bg-divider-adaptive divs with <hr> and border-secondary

* fix: apply requested changes and linting fixes
2025-04-23 09:42:30 -04:00

45 lines
1.7 KiB
Plaintext

<%# locals: (form:) %>
<% condition = form.object %>
<% rule = condition.rule %>
<li data-controller="rule--conditions element-removal" class="border border-secondary rounded-md p-4 space-y-3">
<%= form.hidden_field :condition_type, value: "compound" %>
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<% unless form.index == 0 %>
<div class="pl-2">
<span class="font-medium uppercase text-xs">and</span>
</div>
<% end %>
<p class="text-sm text-secondary">match</p>
<%= form.select :operator, [["all", "and"], ["any", "or"]], { container_class: "w-fit" }, data: { rules_target: "operatorField" } %>
<p class="text-sm text-secondary">of the following conditions</p>
</div>
<button type="button" data-action="element-removal#remove">
<%= icon("trash-2", color: "gray", size: "sm") %>
</button>
</div>
<%# Sub-condition template, used by Stimulus controller to add new sub-conditions dynamically %>
<template data-rule--conditions-target="subConditionTemplate">
<%= form.fields_for :sub_conditions, Rule::Condition.new(parent: condition, condition_type: rule.condition_filters.first.key), child_index: "IDX_PLACEHOLDER" do |scf| %>
<%= render "rule/conditions/condition", form: scf %>
<% end %>
</template>
<ul data-rule--conditions-target="subConditionsList" class="space-y-3">
<%= form.fields_for :sub_conditions do |scf| %>
<%= render "rule/conditions/condition", form: scf, show_prefix: false %>
<% end %>
</ul>
<button type="button" class="btn btn--ghost" data-action="rule--conditions#addSubCondition">
<%= icon("plus", color: "gray", size: "sm") %>
<span>Add condition</span>
</button>
</li>