mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
* 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
45 lines
1.7 KiB
Plaintext
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>
|