Skip to content

Commit

Permalink
UI to delete historical facts
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Nov 27, 2024
1 parent 6e5da65 commit 60b9c0c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 0 additions & 2 deletions app/controllers/historical_facts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions app/views/historical_facts/_actions_kebab.html.erb
Original file line number Diff line number Diff line change
@@ -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" } %>
<div class="dropdown-menu dropdown-menu-end" style="min-width:inherit">
<%= link_to "Delete", organization_historical_fact_path(presenter.organization, fact),
class: "dropdown-item",
data: {
turbo_method: :delete,
turbo_confirm: "This cannot be undone. Proceed?"
} %>
</div>
5 changes: 3 additions & 2 deletions app/views/historical_facts/_historical_fact.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%# locals: (fact:) %>
<%# locals: (fact:, presenter:) %>

<tr class="align-middle">
<tr class="align-middle" id="<%= dom_id(fact) %>">
<td class="text-center">
<%= fact.unreconciled? ?
fa_icon("circle-minus", type: :solid, class: "text-warning", data: { controller: "tooltip" }, title: "Unreconciled") :
Expand All @@ -15,4 +15,5 @@
<td><%= fact.flexible_geolocation %></td>
<td><%= fact.email %></td>
<td><%= fact.phone %></td>
<td><%= render partial: "actions_kebab", locals: { fact: fact, presenter: presenter } %></td>
</tr>
3 changes: 2 additions & 1 deletion app/views/historical_facts/_historical_facts_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@
<th>From</th>
<th>Email</th>
<th>Phone</th>
<th></th>
</tr>
</thead>
<tbody id="historical_facts">
<%= 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} %>
</tbody>
</table>

Expand Down
1 change: 1 addition & 0 deletions app/views/historical_facts/destroy.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= turbo_stream.remove dom_id(@historical_fact) %>

0 comments on commit 60b9c0c

Please sign in to comment.