From 8e6cbc647ea400cc184afc33129cf1b69bfd24ab Mon Sep 17 00:00:00 2001 From: SphericalKat Date: Fri, 8 Oct 2021 01:57:51 +0530 Subject: [PATCH] chore: remove leftover paste controller references Signed-off-by: SphericalKat --- .../controllers/paste_controller.ex | 63 ------------------- lib/ketbin_web/router.ex | 1 - lib/ketbin_web/templates/paste/edit.html.heex | 5 -- lib/ketbin_web/templates/paste/form.html.heex | 19 ------ .../templates/paste/index.html.heex | 28 --------- lib/ketbin_web/templates/paste/new.html.heex | 1 - lib/ketbin_web/templates/paste/show.html.heex | 18 ------ lib/ketbin_web/views/paste_view.ex | 3 - 8 files changed, 138 deletions(-) delete mode 100644 lib/ketbin_web/controllers/paste_controller.ex delete mode 100644 lib/ketbin_web/templates/paste/edit.html.heex delete mode 100644 lib/ketbin_web/templates/paste/form.html.heex delete mode 100644 lib/ketbin_web/templates/paste/index.html.heex delete mode 100644 lib/ketbin_web/templates/paste/new.html.heex delete mode 100644 lib/ketbin_web/templates/paste/show.html.heex delete mode 100644 lib/ketbin_web/views/paste_view.ex diff --git a/lib/ketbin_web/controllers/paste_controller.ex b/lib/ketbin_web/controllers/paste_controller.ex deleted file mode 100644 index 3b02224..0000000 --- a/lib/ketbin_web/controllers/paste_controller.ex +++ /dev/null @@ -1,63 +0,0 @@ -defmodule KetbinWeb.PasteController do - use KetbinWeb, :controller - - alias Ketbin.Pastes - alias Ketbin.Pastes.Paste - - def index(conn, _params) do - pastes = Pastes.list_pastes() - render(conn, "index.html", pastes: pastes) - end - - def new(conn, _params) do - changeset = Pastes.change_paste(%Paste{}) - render(conn, "new.html", changeset: changeset) - end - - def create(conn, %{"paste" => paste_params}) do - # paste_params = Map.put(paste_params, "id", s) - case Pastes.create_paste(paste_params) do - {:ok, paste} -> - conn - |> put_flash(:info, "Paste created successfully.") - |> redirect(to: Routes.paste_path(conn, :show, paste)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "new.html", changeset: changeset) - end - end - - def show(conn, %{"id" => id}) do - paste = Pastes.get_paste!(id) - render(conn, "show.html", paste: paste) - end - - def edit(conn, %{"id" => id}) do - paste = Pastes.get_paste!(id) - changeset = Pastes.change_paste(paste) - render(conn, "edit.html", paste: paste, changeset: changeset) - end - - def update(conn, %{"id" => id, "paste" => paste_params}) do - paste = Pastes.get_paste!(id) - - case Pastes.update_paste(paste, paste_params) do - {:ok, paste} -> - conn - |> put_flash(:info, "Paste updated successfully.") - |> redirect(to: Routes.paste_path(conn, :show, paste)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "edit.html", paste: paste, changeset: changeset) - end - end - - def delete(conn, %{"id" => id}) do - paste = Pastes.get_paste!(id) - {:ok, _paste} = Pastes.delete_paste(paste) - - conn - |> put_flash(:info, "Paste deleted successfully.") - |> redirect(to: Routes.paste_path(conn, :index)) - end -end diff --git a/lib/ketbin_web/router.ex b/lib/ketbin_web/router.ex index 9d6539d..647fac1 100644 --- a/lib/ketbin_web/router.ex +++ b/lib/ketbin_web/router.ex @@ -96,6 +96,5 @@ defmodule KetbinWeb.Router do post "/users/confirm", UserConfirmationController, :create get "/users/confirm/:token", UserConfirmationController, :confirm - resources "/pastes", PasteController end end diff --git a/lib/ketbin_web/templates/paste/edit.html.heex b/lib/ketbin_web/templates/paste/edit.html.heex deleted file mode 100644 index 0bb1c93..0000000 --- a/lib/ketbin_web/templates/paste/edit.html.heex +++ /dev/null @@ -1,5 +0,0 @@ -

Edit Paste

- -<%= render "form.html", Map.put(assigns, :action, Routes.paste_path(@conn, :update, @paste)) %> - -<%= link "Back", to: Routes.paste_path(@conn, :index) %> diff --git a/lib/ketbin_web/templates/paste/form.html.heex b/lib/ketbin_web/templates/paste/form.html.heex deleted file mode 100644 index ecc0d25..0000000 --- a/lib/ketbin_web/templates/paste/form.html.heex +++ /dev/null @@ -1,19 +0,0 @@ -<%= form_for @changeset, @action, fn f -> %> - <%= if @changeset.action do %> -
-

Oops, something went wrong! Please check the errors below.

-
- <% end %> - - <%= label f, :is_url %> - <%= checkbox f, :is_url %> - <%= error_tag f, :is_url %> - - <%= label f, :content %> - <%= textarea f, :content %> - <%= error_tag f, :content %> - -
- <%= submit "Save" %> -
-<% end %> diff --git a/lib/ketbin_web/templates/paste/index.html.heex b/lib/ketbin_web/templates/paste/index.html.heex deleted file mode 100644 index 3eb7ecd..0000000 --- a/lib/ketbin_web/templates/paste/index.html.heex +++ /dev/null @@ -1,28 +0,0 @@ -

Listing Pastes

- - - - - - - - - - - -<%= for paste <- @pastes do %> - - - - - - -<% end %> - -
Is urlContent
<%= paste.is_url %><%= paste.content %> - <%= link "Show", to: Routes.paste_path(@conn, :show, paste) %> - <%= link "Edit", to: Routes.paste_path(@conn, :edit, paste) %> - <%= link "Delete", to: Routes.paste_path(@conn, :delete, paste), method: :delete, data: [confirm: "Are you sure?"] %> -
- -<%= link "New Paste", to: Routes.paste_path(@conn, :new) %> diff --git a/lib/ketbin_web/templates/paste/new.html.heex b/lib/ketbin_web/templates/paste/new.html.heex deleted file mode 100644 index b1e4f3f..0000000 --- a/lib/ketbin_web/templates/paste/new.html.heex +++ /dev/null @@ -1 +0,0 @@ -<%= render "form.html", Map.put(assigns, :action, Routes.paste_path(@conn, :create)) %> diff --git a/lib/ketbin_web/templates/paste/show.html.heex b/lib/ketbin_web/templates/paste/show.html.heex deleted file mode 100644 index b1cb68d..0000000 --- a/lib/ketbin_web/templates/paste/show.html.heex +++ /dev/null @@ -1,18 +0,0 @@ -

Show Paste

- - - -<%= link "Edit", to: Routes.paste_path(@conn, :edit, @paste) %> -<%= link "Back", to: Routes.paste_path(@conn, :index) %> diff --git a/lib/ketbin_web/views/paste_view.ex b/lib/ketbin_web/views/paste_view.ex deleted file mode 100644 index 5cfb6d9..0000000 --- a/lib/ketbin_web/views/paste_view.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule KetbinWeb.PasteView do - use KetbinWeb, :view -end