mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 07:25:19 +02:00
Add ability to delete all tags
This commit is contained in:
parent
441f436187
commit
1fb39f78ee
3 changed files with 27 additions and 7 deletions
|
@ -34,6 +34,11 @@ class TagsController < ApplicationController
|
|||
redirect_to tags_path, notice: t(".deleted")
|
||||
end
|
||||
|
||||
def destroy_all
|
||||
Current.family.tags.destroy_all
|
||||
redirect_back_or_to tags_path, notice: "All tags deleted"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_tag
|
||||
|
|
|
@ -1,13 +1,27 @@
|
|||
<header class="flex items-center justify-between">
|
||||
<h1 class="text-primary text-xl font-medium"><%= t(".tags") %></h1>
|
||||
|
||||
<%= render LinkComponent.new(
|
||||
text: t(".new"),
|
||||
variant: "primary",
|
||||
href: new_tag_path,
|
||||
icon: "plus",
|
||||
frame: :modal
|
||||
) %>
|
||||
<div class="flex items-center gap-2">
|
||||
<%= render MenuComponent.new do |menu| %>
|
||||
<% menu.with_item(
|
||||
variant: "button",
|
||||
text: "Delete all",
|
||||
href: destroy_all_tags_path,
|
||||
method: :delete,
|
||||
icon: "trash-2",
|
||||
confirm: CustomConfirm.for_resource_deletion("all tags", high_severity: true)) %>
|
||||
<% end %>
|
||||
|
||||
<%= render LinkComponent.new(
|
||||
text: t(".new"),
|
||||
variant: "primary",
|
||||
href: new_tag_path,
|
||||
icon: "plus",
|
||||
frame: :modal
|
||||
) %>
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
<div class="bg-container shadow-border-xs rounded-xl p-4">
|
||||
|
|
|
@ -64,6 +64,7 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :tags, except: :show do
|
||||
resources :deletions, only: %i[new create], module: :tag
|
||||
delete :destroy_all, on: :collection
|
||||
end
|
||||
|
||||
namespace :category do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue