Files
sure/app/views/rules/index.html.erb
Alex Hatzenbuhler c022e862aa Add ability to delete all tags (#2200)
* Add ability to delete all tags

* Downcase resource for confirmation

* Clean up deletion resource names

* titleize button
2025-05-05 12:43:46 -04:00

68 lines
2.1 KiB
Plaintext

<header class="flex items-center justify-between">
<h1 class="text-primary text-xl font-medium">Rules</h1>
<div class="flex items-center gap-2">
<% if @rules.any? %>
<%= render MenuComponent.new do |menu| %>
<% menu.with_item(
variant: "button",
text: "Delete all rules",
href: destroy_all_rules_path,
icon: "trash-2",
method: :delete,
confirm: CustomConfirm.for_resource_deletion("all rules", high_severity: true)) %>
<% end %>
<% end %>
<%= render LinkComponent.new(
text: "New rule",
variant: "primary",
href: new_rule_path(resource_type: "transaction"),
icon: "plus",
frame: :modal
) %>
</div>
</header>
<% if self_hosted? %>
<div class="flex items-center gap-2 mb-2 py-4">
<%= icon("circle-alert", size: "sm") %>
<p class="text-sm text-secondary">
AI-enabled rule actions will cost money. Be sure to filter as narrowly as possible to avoid unnecessary costs.
</p>
</div>
<% end %>
<div class="bg-container shadow-border-xs rounded-xl p-4">
<% if @rules.any? %>
<div class="rounded-xl bg-gray-25 space-y-1">
<div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-secondary uppercase">
<p>Rules</p>
<span class="text-subdued">&middot;</span>
<p><%= @rules.count %></p>
</div>
<div class="space-y-1 p-1">
<%= render @rules %>
</div>
</div>
<% else %>
<div class="flex justify-center items-center py-20">
<div class="text-center flex flex-col items-center max-w-[500px]">
<p class="text-sm text-primary font-medium mb-1">No rules yet</p>
<p class="text-sm text-secondary mb-4">Set up rules to perform actions to your transactions and other data on every account sync.</p>
<div class="flex items-center gap-2">
<%= render LinkComponent.new(
text: "New rule",
variant: "primary",
href: new_rule_path(resource_type: "transaction"),
icon: "plus",
frame: :modal
) %>
</div>
</div>
</div>
<% end %>
</div>