mirror of
https://github.com/we-promise/sure.git
synced 2026-04-11 00:04:47 +00:00
* Add ability to name a rule * Add sorting by name and date, * Improve rule page and form design * Small header tweak * Improve sorting click areas by including icon * Fix brakeman * Use icon helper instead of lucide_icon helper * Fix double headers with new DialogComponent * Use updated_at for sorting instead of created_at * Use copy-plus icon for compound rules * Remove icons and change IF/THEN/FOR font in edit form * Use text-secondary on disabled rules * First pass at redesigning the sorting menu * New rule list * Borders instead of shadows * Apply proper text color to TO in edit form * Improve dark mode with proper background color classes * Use border-secondary * Add touch: true to conditions and actions of a rule, so updated_at works as expected * Fix db schema * Change sort direction to be a LinkComponent outside of the form for better sort behavior * Clean up dropdown design to match figma * Match tags/categories design * Fix name text color, add bg-divider background for dividers * Fix family subscription tests (thanks zach!)
43 lines
1.9 KiB
Plaintext
43 lines
1.9 KiB
Plaintext
<%# locals: (form:) %>
|
|
|
|
<% action = form.object %>
|
|
<% rule = action.rule %>
|
|
|
|
<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" } %>
|
|
|
|
<div class="grow flex gap-2 items-center h-full">
|
|
<div class="grow">
|
|
<%= 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"),
|
|
data: { rule__actions_target: "actionValue" } do %>
|
|
<%# Initial rendering based on rule.action_executors.first from the rule form. %>
|
|
<%# This is currently always SetTransactionCategory from transaction_resource.rb, which is a select type. %>
|
|
<%# Subsequent renders are injected by the Stimulus controller, which uses the templates from below. %>
|
|
<span class="font-medium text-primary uppercase text-xs">to</span>
|
|
<%= form.select :value, action.options || [], {} %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= icon(
|
|
"trash-2",
|
|
size: "sm",
|
|
as_button: true,
|
|
data: { action: "rule--actions#remove", rule__actions_destroy_param: action.persisted? }) %>
|
|
|
|
<%# Templates for different input types - these will be cloned and used by the Stimulus controller %>
|
|
<template data-rule--actions-target="selectTemplate">
|
|
<span class="font-medium text-primary uppercase text-xs">to</span>
|
|
<%= form.select :value, [], {} %>
|
|
</template>
|
|
|
|
<template data-rule--actions-target="textTemplate">
|
|
<span class="font-medium text-primary uppercase text-xs">to</span>
|
|
<%= form.text_field :value, placeholder: "Enter a value" %>
|
|
</template>
|
|
|
|
<%# The function type doesn't need an input, so no template is required.%>
|
|
</li>
|