mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-03 04:25:21 +02:00
Add tag filtering (#1240)
This commit is contained in:
parent
73d61fc990
commit
e8d7ee3270
5 changed files with 40 additions and 6 deletions
25
app/views/transactions/searches/filters/_tag_filter.html.erb
Normal file
25
app/views/transactions/searches/filters/_tag_filter.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<%# locals: (form:) %>
|
||||
<div data-controller="list-filter">
|
||||
<div class="relative">
|
||||
<input type="search" autocomplete="off" placeholder="Filter tags" data-list-filter-target="input" data-action="input->list-filter#filter" class="block w-full border border-gray-200 rounded-md py-2 pl-10 pr-3 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
|
||||
<%= lucide_icon("search", class: "w-5 h-5 text-gray-500 absolute inset-y-0 left-2 top-1/2 transform -translate-y-1/2") %>
|
||||
</div>
|
||||
<div class="my-2" id="list" data-list-filter-target="list">
|
||||
<% Current.family.tags.alphabetically.each do |tag| %>
|
||||
<div class="filterable-item flex items-center gap-2 p-2" data-filter-name="<%= tag.name %>">
|
||||
<%= form.check_box :tags,
|
||||
{
|
||||
multiple: true,
|
||||
checked: @q[:tags]&.include?(tag.name),
|
||||
class: "maybe-checkbox maybe-checkbox--light"
|
||||
},
|
||||
tag.name,
|
||||
nil %>
|
||||
<%= form.label :tags, value: tag.name, class: "text-sm text-gray-900 flex items-center gap-2" do %>
|
||||
<%= circle_logo(tag.name, hex: tag.color || Tag::UNCATEGORIZED_COLOR, size: "sm") %>
|
||||
<%= tag.name %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue