mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 21:15:19 +02:00
* Add lookbook + viewcomponent, organize design system file * Build menu component * Button updates * More button fixes * Replace all menus with new ViewComponent * Checkpoint: fix tests, all buttons and menus converted * Split into Link and Button components for clarity * Button cleanup * Simplify custom confirmation configuration in views * Finalize button, link component API * Add toggle field to custom form builder + Component * Basic tabs component * Custom tabs, convert all menu / tab instances in app * Gem updates * Centralized icon helper * Update all icon usage to central helper * Lint fixes * Centralize all disclosure instances * Dialog replacements * Consolidation of all dialog styles * Test fixes * Fix app layout issues, move to component with slots * Layout simplification * Flakey test fix * Fix dashboard mobile issues * Finalize homepage * Lint fixes * Fix shadows and borders in dark mode * Fix tests * Remove stale class * Fix filled icon logic * Move transparent? to public interface
61 lines
2.6 KiB
Text
61 lines
2.6 KiB
Text
<%# locals: (rule:) %>
|
|
|
|
<div class="flex justify-between items-center gap-4 bg-white shadow-border-xs rounded-md p-4">
|
|
<div class="text-sm space-y-1.5">
|
|
<% if rule.conditions.any? %>
|
|
<p class="flex items-center flex-wrap gap-1.5">
|
|
<span class="px-2 py-1 border border-alpha-black-200 rounded-full">
|
|
<% if rule.conditions.first.compound? %>
|
|
If <%= rule.conditions.first.sub_conditions.first.filter.label %> <%= rule.conditions.first.sub_conditions.first.operator %> <%= rule.conditions.first.sub_conditions.first.value_display %>
|
|
<% else %>
|
|
If <%= rule.conditions.first.filter.label %> <%= rule.conditions.first.operator %> <%= rule.conditions.first.value_display %>
|
|
<% end %>
|
|
</span>
|
|
|
|
<% if rule.conditions.count > 1 %>
|
|
and <%= rule.conditions.count - 1 %> more <%= rule.conditions.count - 1 == 1 ? "condition" : "conditions" %>
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<p class="flex items-center flex-wrap gap-1.5">
|
|
<span class="px-2 py-1 border border-alpha-black-200 rounded-full">
|
|
<% if rule.actions.first.value && rule.actions.first.options %>
|
|
<%= rule.actions.first.executor.label %> to <%= rule.actions.first.value_display %>
|
|
<% else %>
|
|
<%= rule.actions.first.executor.label %>
|
|
<% end %>
|
|
</span>
|
|
|
|
<% if rule.actions.count > 1 %>
|
|
and <%= rule.actions.count - 1 %> more <%= rule.actions.count - 1 == 1 ? "action" : "actions" %>
|
|
<% end %>
|
|
</p>
|
|
|
|
<p class="flex items-center flex-wrap gap-1.5">
|
|
<% if rule.effective_date.nil? %>
|
|
To all past and future <%= rule.resource_type.pluralize %>
|
|
<% else %>
|
|
To all <%= rule.resource_type.pluralize %> on or after <%= rule.effective_date %>
|
|
<% end %>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-4">
|
|
<%= styled_form_with model: rule, data: { controller: "auto-submit-form" } do |f| %>
|
|
<%= f.toggle :active, { data: { auto_submit_form_target: "auto" } } %>
|
|
<% end %>
|
|
|
|
<%= render MenuComponent.new do |menu| %>
|
|
<% menu.with_item(variant: "link", text: "Edit", href: edit_rule_path(rule), icon: "pencil", data: { turbo_frame: "modal" }) %>
|
|
<% menu.with_item(variant: "link", text: "Re-apply rule", href: confirm_rule_path(rule), icon: "refresh-cw", data: { turbo_frame: "modal" }) %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: "Delete",
|
|
href: rule_path(rule),
|
|
icon: "trash-2",
|
|
method: :delete,
|
|
confirm: CustomConfirm.for_resource_deletion("Rule")) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|