diff --git a/lib/philomena_web/controllers/comment_controller.ex b/lib/philomena_web/controllers/comment_controller.ex deleted file mode 100644 index c681055a..00000000 --- a/lib/philomena_web/controllers/comment_controller.ex +++ /dev/null @@ -1,62 +0,0 @@ -defmodule PhilomenaWeb.CommentController do - use PhilomenaWeb, :controller - - alias Philomena.Comments - alias Philomena.Comments.Comment - - def index(conn, _params) do - comments = Comments.list_comments() - render(conn, "index.html", comments: comments) - end - - def new(conn, _params) do - changeset = Comments.change_comment(%Comment{}) - render(conn, "new.html", changeset: changeset) - end - - def create(conn, %{"comment" => comment_params}) do - case Comments.create_comment(comment_params) do - {:ok, comment} -> - conn - |> put_flash(:info, "Comment created successfully.") - |> redirect(to: Routes.comment_path(conn, :show, comment)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "new.html", changeset: changeset) - end - end - - def show(conn, %{"id" => id}) do - comment = Comments.get_comment!(id) - render(conn, "show.html", comment: comment) - end - - def edit(conn, %{"id" => id}) do - comment = Comments.get_comment!(id) - changeset = Comments.change_comment(comment) - render(conn, "edit.html", comment: comment, changeset: changeset) - end - - def update(conn, %{"id" => id, "comment" => comment_params}) do - comment = Comments.get_comment!(id) - - case Comments.update_comment(comment, comment_params) do - {:ok, comment} -> - conn - |> put_flash(:info, "Comment updated successfully.") - |> redirect(to: Routes.comment_path(conn, :show, comment)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "edit.html", comment: comment, changeset: changeset) - end - end - - def delete(conn, %{"id" => id}) do - comment = Comments.get_comment!(id) - {:ok, _comment} = Comments.delete_comment(comment) - - conn - |> put_flash(:info, "Comment deleted successfully.") - |> redirect(to: Routes.comment_path(conn, :index)) - end -end diff --git a/lib/philomena_web/controllers/image_controller.ex b/lib/philomena_web/controllers/image_controller.ex index 49112031..4f7a2f51 100644 --- a/lib/philomena_web/controllers/image_controller.ex +++ b/lib/philomena_web/controllers/image_controller.ex @@ -21,23 +21,6 @@ defmodule PhilomenaWeb.ImageController do render(conn, "index.html", images: images) end - def new(conn, _params) do - changeset = Images.change_image(%Image{}) - render(conn, "new.html", changeset: changeset) - end - - def create(conn, %{"image" => image_params}) do - case Images.create_image(image_params) do - {:ok, image} -> - conn - |> put_flash(:info, "Image created successfully.") - |> redirect(to: Routes.image_path(conn, :show, image)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "new.html", changeset: changeset) - end - end - def show(conn, %{"id" => id}) do image = Images.get_image!(id) render(conn, "show.html", image: image) diff --git a/lib/philomena_web/controllers/tag_controller.ex b/lib/philomena_web/controllers/tag_controller.ex index 350c820e..b91137b4 100644 --- a/lib/philomena_web/controllers/tag_controller.ex +++ b/lib/philomena_web/controllers/tag_controller.ex @@ -2,61 +2,14 @@ defmodule PhilomenaWeb.TagController do use PhilomenaWeb, :controller alias Philomena.Tags - alias Philomena.Tags.Tag def index(conn, _params) do tags = Tags.list_tags() render(conn, "index.html", tags: tags) end - def new(conn, _params) do - changeset = Tags.change_tag(%Tag{}) - render(conn, "new.html", changeset: changeset) - end - - def create(conn, %{"tag" => tag_params}) do - case Tags.create_tag(tag_params) do - {:ok, tag} -> - conn - |> put_flash(:info, "Tag created successfully.") - |> redirect(to: Routes.tag_path(conn, :show, tag)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "new.html", changeset: changeset) - end - end - def show(conn, %{"id" => id}) do tag = Tags.get_tag!(id) render(conn, "show.html", tag: tag) end - - def edit(conn, %{"id" => id}) do - tag = Tags.get_tag!(id) - changeset = Tags.change_tag(tag) - render(conn, "edit.html", tag: tag, changeset: changeset) - end - - def update(conn, %{"id" => id, "tag" => tag_params}) do - tag = Tags.get_tag!(id) - - case Tags.update_tag(tag, tag_params) do - {:ok, tag} -> - conn - |> put_flash(:info, "Tag updated successfully.") - |> redirect(to: Routes.tag_path(conn, :show, tag)) - - {:error, %Ecto.Changeset{} = changeset} -> - render(conn, "edit.html", tag: tag, changeset: changeset) - end - end - - def delete(conn, %{"id" => id}) do - tag = Tags.get_tag!(id) - {:ok, _tag} = Tags.delete_tag(tag) - - conn - |> put_flash(:info, "Tag deleted successfully.") - |> redirect(to: Routes.tag_path(conn, :index)) - end end diff --git a/lib/philomena_web/templates/comment/edit.html.eex b/lib/philomena_web/templates/comment/edit.html.eex deleted file mode 100644 index cd80fb3a..00000000 --- a/lib/philomena_web/templates/comment/edit.html.eex +++ /dev/null @@ -1,5 +0,0 @@ -
Oops, something went wrong! Please check the errors below.
-- |
---|
- <%= link "Show", to: Routes.comment_path(@conn, :show, comment) %> - <%= link "Edit", to: Routes.comment_path(@conn, :edit, comment) %> - <%= link "Delete", to: Routes.comment_path(@conn, :delete, comment), method: :delete, data: [confirm: "Are you sure?"] %> - | -
Oops, something went wrong! Please check the errors below.
-Oops, something went wrong! Please check the errors below.
-