Update to refactor the unused and deprecated code.
This commit is contained in:
@@ -2,8 +2,6 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.JustSearchResources
|
|||||||
use Phoenix.Component
|
use Phoenix.Component
|
||||||
use DecentralisedBookIndexWeb, :verified_routes
|
use DecentralisedBookIndexWeb, :verified_routes
|
||||||
|
|
||||||
alias DecentralisedBookIndex.Accounts.Role
|
|
||||||
|
|
||||||
attr :search_query, :string, default: ""
|
attr :search_query, :string, default: ""
|
||||||
attr :select_options, :list, required: true
|
attr :select_options, :list, required: true
|
||||||
attr :selected_option, :string, required: true
|
attr :selected_option, :string, required: true
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
|
|||||||
|> assign(:page_title, "Edit Author")
|
|> assign(:page_title, "Edit Author")
|
||||||
|> assign(
|
|> assign(
|
||||||
:author,
|
:author,
|
||||||
Ash.get!(DecentralisedBookIndex.Metadata.Author, id, actor: socket.assigns.current_user)
|
Ash.get!(Metadata.Author, id, actor: socket.assigns.current_user)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.FormComponent do
|
|||||||
|
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, author_id))
|
|> push_navigate(to: patch_url(socket.assigns.action, author_id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
@@ -109,7 +109,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.FormComponent do
|
|||||||
actor: socket.assigns.current_user
|
actor: socket.assigns.current_user
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
AshPhoenix.Form.for_create(DecentralisedBookIndex.Metadata.Author, :create,
|
AshPhoenix.Form.for_create(Metadata.Author, :create,
|
||||||
as: "author",
|
as: "author",
|
||||||
actor: socket.assigns.current_user
|
actor: socket.assigns.current_user
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_event("add-bid", params, socket) do
|
def handle_event("add-bid", _params, socket) do
|
||||||
socket =
|
socket =
|
||||||
update(socket, :form, fn form ->
|
update(socket, :form, fn form ->
|
||||||
AshPhoenix.Form.add_form(form, :bids)
|
AshPhoenix.Form.add_form(form, :bids)
|
||||||
@@ -265,7 +265,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_event("add-author-role", params, socket) do
|
def handle_event("add-author-role", _params, socket) do
|
||||||
socket =
|
socket =
|
||||||
update(socket, :form, fn form ->
|
update(socket, :form, fn form ->
|
||||||
AshPhoenix.Form.add_form(form, :author_roles)
|
AshPhoenix.Form.add_form(form, :author_roles)
|
||||||
@@ -333,7 +333,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|||||||
|
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, book_id))
|
|> push_navigate(to: patch_url(socket.assigns.action, book_id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
@@ -409,7 +409,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
|||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event("open-select-author", %{"path" => path, "value" => value}, socket) do
|
def handle_event("open-select-author", %{"path" => path}, socket) do
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> assign(:select_author_open?, true)
|
|> assign(:select_author_open?, true)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Edit do
|
|||||||
|> assign(:page_title, "Edit Server")
|
|> assign(:page_title, "Edit Server")
|
||||||
|> assign(
|
|> assign(
|
||||||
:dbi_server,
|
:dbi_server,
|
||||||
Ash.get!(DecentralisedBookIndex.Metadata.DBIServer, id, actor: socket.assigns.current_user)
|
Ash.get!(Metadata.DBIServer, id, actor: socket.assigns.current_user)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.FormComponent do
|
|||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> put_flash(:info, "Server #{socket.assigns.form.source.type}d successfully")
|
|> put_flash(:info, "Server #{socket.assigns.form.source.type}d successfully")
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, dbi_server.id))
|
|> push_navigate(to: patch_url(socket.assigns.action, dbi_server.id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.FormComponent do
|
|||||||
|
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, dbi_server_id))
|
|> push_navigate(to: patch_url(socket.assigns.action, dbi_server_id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Index do
|
|||||||
|> apply_action(socket.assigns.live_action, params)
|
|> apply_action(socket.assigns.live_action, params)
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
# {:noreply, apply_action(socket, socket.assigns.live_action, params)}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp apply_action(socket, :edit, %{"id" => id}) do
|
defp apply_action(socket, :edit, %{"id" => id}) do
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
|
|||||||
|> assign(:page_title, "Edit Publisher")
|
|> assign(:page_title, "Edit Publisher")
|
||||||
|> assign(
|
|> assign(
|
||||||
:publisher,
|
:publisher,
|
||||||
Ash.get!(DecentralisedBookIndex.Metadata.Publisher, id, actor: socket.assigns.current_user)
|
Ash.get!(Metadata.Publisher, id, actor: socket.assigns.current_user)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.FormComponent do
|
|||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> put_flash(:info, "Publisher #{socket.assigns.form.source.type}d successfully")
|
|> put_flash(:info, "Publisher #{socket.assigns.form.source.type}d successfully")
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, publisher.id))
|
|> push_navigate(to: patch_url(socket.assigns.action, publisher.id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.FormComponent do
|
|||||||
|
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, publisher_id))
|
|> push_navigate(to: patch_url(socket.assigns.action, publisher_id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.FormComponent do
|
|||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> put_flash(:info, "User #{socket.assigns.form.source.type}d successfully")
|
|> put_flash(:info, "User #{socket.assigns.form.source.type}d successfully")
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, user.id))
|
|> push_navigate(to: patch_url(socket.assigns.action, user.id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.FormComponent do
|
|||||||
|
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, user_id))
|
|> push_navigate(to: patch_url(socket.assigns.action, user_id))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
@@ -92,7 +92,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.FormComponent do
|
|||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> put_flash(:info, "User not exists successfully")
|
|> put_flash(:info, "User not exists successfully")
|
||||||
|> push_redirect(to: patch_url(socket.assigns.action, nil))
|
|> push_navigate(to: patch_url(socket.assigns.action, nil))
|
||||||
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user