From 60b9c0cc617ff737cb325b6884b5d58d0c1e9257 Mon Sep 17 00:00:00 2001 From: moveson Date: Wed, 27 Nov 2024 08:31:09 -0700 Subject: [PATCH] UI to delete historical facts --- app/controllers/historical_facts_controller.rb | 2 -- app/views/historical_facts/_actions_kebab.html.erb | 13 +++++++++++++ .../historical_facts/_historical_fact.html.erb | 5 +++-- .../_historical_facts_list.html.erb | 3 ++- app/views/historical_facts/destroy.turbo_stream.erb | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 app/views/historical_facts/_actions_kebab.html.erb create mode 100644 app/views/historical_facts/destroy.turbo_stream.erb diff --git a/app/controllers/historical_facts_controller.rb b/app/controllers/historical_facts_controller.rb index 48eddb68c..5cbfa8552 100644 --- a/app/controllers/historical_facts_controller.rb +++ b/app/controllers/historical_facts_controller.rb @@ -45,8 +45,6 @@ def update # DELETE /organizations/1/historical_facts/1/destroy def destroy @historical_fact.destroy - flash[:success] = "Historical fact deleted." - redirect_to :index end # PATCH /organizations/1/historical_facts/auto_reconcile diff --git a/app/views/historical_facts/_actions_kebab.html.erb b/app/views/historical_facts/_actions_kebab.html.erb new file mode 100644 index 000000000..11452cb98 --- /dev/null +++ b/app/views/historical_facts/_actions_kebab.html.erb @@ -0,0 +1,13 @@ +<%# locals: (fact:, presenter:) -%> + +<%= button_tag fa_icon("ellipsis-h"), + class: "dropdown-toggle no-caret btn btn-sm btn-light", + data: { bs_toggle: "dropdown" } %> + diff --git a/app/views/historical_facts/_historical_fact.html.erb b/app/views/historical_facts/_historical_fact.html.erb index 557fd1bb2..2b661d5dd 100644 --- a/app/views/historical_facts/_historical_fact.html.erb +++ b/app/views/historical_facts/_historical_fact.html.erb @@ -1,6 +1,6 @@ -<%# locals: (fact:) %> +<%# locals: (fact:, presenter:) %> - + <%= fact.unreconciled? ? fa_icon("circle-minus", type: :solid, class: "text-warning", data: { controller: "tooltip" }, title: "Unreconciled") : @@ -15,4 +15,5 @@ <%= fact.flexible_geolocation %> <%= fact.email %> <%= fact.phone %> + <%= render partial: "actions_kebab", locals: { fact: fact, presenter: presenter } %> diff --git a/app/views/historical_facts/_historical_facts_list.html.erb b/app/views/historical_facts/_historical_facts_list.html.erb index 90b00fa42..feec9425d 100644 --- a/app/views/historical_facts/_historical_facts_list.html.erb +++ b/app/views/historical_facts/_historical_facts_list.html.erb @@ -35,10 +35,11 @@ From Email Phone + - <%= render partial: "historical_fact", collection: presenter.filtered_historical_facts, as: :fact %> + <%= render partial: "historical_fact", collection: presenter.filtered_historical_facts, as: :fact, locals: { presenter: presenter} %> diff --git a/app/views/historical_facts/destroy.turbo_stream.erb b/app/views/historical_facts/destroy.turbo_stream.erb new file mode 100644 index 000000000..9f2a3e1f4 --- /dev/null +++ b/app/views/historical_facts/destroy.turbo_stream.erb @@ -0,0 +1 @@ +<%= turbo_stream.remove dom_id(@historical_fact) %>