diff --git a/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex b/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex index 3ae57571..4e520c33 100644 --- a/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex +++ b/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex @@ -7,7 +7,12 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do import Ecto.Query plug :verify_authorized - plug :load_resource, model: FingerprintBan, only: [:edit, :update, :delete] + + plug :load_resource, + model: FingerprintBan, + as: :fingerprint_ban, + only: [:edit, :update, :delete] + plug :check_can_delete when action in [:delete] def index(conn, %{"q" => q}) when is_binary(q) do @@ -56,12 +61,12 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do end def edit(conn, _params) do - changeset = Bans.change_fingerprint(conn.assigns.fingerprint) + changeset = Bans.change_fingerprint(conn.assigns.fingerprint_ban) render(conn, "edit.html", title: "Editing Fingerprint Ban", changeset: changeset) end def update(conn, %{"fingerprint" => fingerprint_ban_params}) do - case Bans.update_fingerprint(conn.assigns.fingerprint, fingerprint_ban_params) do + case Bans.update_fingerprint(conn.assigns.fingerprint_ban, fingerprint_ban_params) do {:ok, fingerprint_ban} -> conn |> put_flash(:info, "Fingerprint ban successfully updated.") @@ -74,7 +79,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do end def delete(conn, _params) do - {:ok, fingerprint_ban} = Bans.delete_fingerprint(conn.assigns.fingerprint) + {:ok, fingerprint_ban} = Bans.delete_fingerprint(conn.assigns.fingerprint_ban) conn |> put_flash(:info, "Fingerprint ban successfully deleted.") diff --git a/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime b/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime index eb424776..1f9ff5ff 100644 --- a/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime +++ b/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime @@ -1,6 +1,6 @@ h1 Editing ban -= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans/#{@fingerprint}", conn: @conn += render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans/#{@fingerprint_ban}", conn: @conn br = link "Back", to: ~p"/admin/fingerprint_bans"