Skip to content

Commit

Permalink
remove brainstorming from local storage when delete button is used
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek committed Dec 19, 2024
1 parent d572326 commit e2a2aa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ defmodule MindwendelWeb.Admin.BrainstormingController do
end

def delete(conn, %{"id" => id}) do
Brainstormings.get_brainstorming_by!(%{admin_url_id: id})
|> Brainstormings.delete_brainstorming()
brainstorming = Brainstormings.get_brainstorming_by!(%{admin_url_id: id})
Brainstormings.delete_brainstorming(brainstorming)

conn
|> put_flash(:info, gettext("Successfully deleted brainstorming."))
|> put_flash(:missing_brainstorming_id, brainstorming.id)
|> redirect(to: "/")
end

Expand Down
8 changes: 7 additions & 1 deletion lib/mindwendel_web/templates/layout/app_static.html.heex
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<main role="main" class="container h-100" id="main-container">
<%= if Phoenix.Flash.get(@flash, :info) do %>
<p class="alert alert-info" role="alert">
<p
id="alert-info"
class="alert alert-info"
role="alert"
phx-hook="RemoveMissingBrainstorming"
data-brainstorming-id={Phoenix.Flash.get(@flash, :missing_brainstorming_id)}
>
{Phoenix.Flash.get(@flash, :info)}
</p>
<% end %>
Expand Down

0 comments on commit e2a2aa3

Please sign in to comment.