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 @@ -

Edit Comment

- -<%= render "form.html", Map.put(assigns, :action, Routes.comment_path(@conn, :update, @comment)) %> - -<%= link "Back", to: Routes.comment_path(@conn, :index) %> diff --git a/lib/philomena_web/templates/comment/form.html.eex b/lib/philomena_web/templates/comment/form.html.eex deleted file mode 100644 index a8b33630..00000000 --- a/lib/philomena_web/templates/comment/form.html.eex +++ /dev/null @@ -1,11 +0,0 @@ -<%= form_for @changeset, @action, fn f -> %> - <%= if @changeset.action do %> -
-

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

-
- <% end %> - -
- <%= submit "Save" %> -
-<% end %> diff --git a/lib/philomena_web/templates/comment/index.html.eex b/lib/philomena_web/templates/comment/index.html.eex deleted file mode 100644 index bada0732..00000000 --- a/lib/philomena_web/templates/comment/index.html.eex +++ /dev/null @@ -1,24 +0,0 @@ -

Listing Comments

- - - - - - - - - -<%= for comment <- @comments do %> - - - - -<% end %> - -
- <%= 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?"] %> -
- -<%= link "New Comment", to: Routes.comment_path(@conn, :new) %> diff --git a/lib/philomena_web/templates/comment/new.html.eex b/lib/philomena_web/templates/comment/new.html.eex deleted file mode 100644 index 931e4cf3..00000000 --- a/lib/philomena_web/templates/comment/new.html.eex +++ /dev/null @@ -1,5 +0,0 @@ -

New Comment

- -<%= render "form.html", Map.put(assigns, :action, Routes.comment_path(@conn, :create)) %> - -<%= link "Back", to: Routes.comment_path(@conn, :index) %> diff --git a/lib/philomena_web/templates/comment/show.html.eex b/lib/philomena_web/templates/comment/show.html.eex deleted file mode 100644 index 4dbf4995..00000000 --- a/lib/philomena_web/templates/comment/show.html.eex +++ /dev/null @@ -1,8 +0,0 @@ -

Show Comment

- - - -<%= link "Edit", to: Routes.comment_path(@conn, :edit, @comment) %> -<%= link "Back", to: Routes.comment_path(@conn, :index) %> diff --git a/lib/philomena_web/templates/image/edit.html.eex b/lib/philomena_web/templates/image/edit.html.eex deleted file mode 100644 index 595c1aac..00000000 --- a/lib/philomena_web/templates/image/edit.html.eex +++ /dev/null @@ -1,5 +0,0 @@ -

Edit Image

- -<%= render "form.html", Map.put(assigns, :action, Routes.image_path(@conn, :update, @image)) %> - -<%= link "Back", to: Routes.image_path(@conn, :index) %> diff --git a/lib/philomena_web/templates/image/form.html.eex b/lib/philomena_web/templates/image/form.html.eex deleted file mode 100644 index a8b33630..00000000 --- a/lib/philomena_web/templates/image/form.html.eex +++ /dev/null @@ -1,11 +0,0 @@ -<%= form_for @changeset, @action, fn f -> %> - <%= if @changeset.action do %> -
-

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

-
- <% end %> - -
- <%= submit "Save" %> -
-<% end %> diff --git a/lib/philomena_web/templates/image/new.html.eex b/lib/philomena_web/templates/image/new.html.eex deleted file mode 100644 index cf0236b4..00000000 --- a/lib/philomena_web/templates/image/new.html.eex +++ /dev/null @@ -1,5 +0,0 @@ -

New Image

- -<%= render "form.html", Map.put(assigns, :action, Routes.image_path(@conn, :create)) %> - -<%= link "Back", to: Routes.image_path(@conn, :index) %> diff --git a/lib/philomena_web/templates/tag/edit.html.eex b/lib/philomena_web/templates/tag/edit.html.eex deleted file mode 100644 index f2f4987a..00000000 --- a/lib/philomena_web/templates/tag/edit.html.eex +++ /dev/null @@ -1,5 +0,0 @@ -

Edit Tag

- -<%= render "form.html", Map.put(assigns, :action, Routes.tag_path(@conn, :update, @tag)) %> - -<%= link "Back", to: Routes.tag_path(@conn, :index) %> diff --git a/lib/philomena_web/templates/tag/form.html.eex b/lib/philomena_web/templates/tag/form.html.eex deleted file mode 100644 index a8b33630..00000000 --- a/lib/philomena_web/templates/tag/form.html.eex +++ /dev/null @@ -1,11 +0,0 @@ -<%= form_for @changeset, @action, fn f -> %> - <%= if @changeset.action do %> -
-

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

-
- <% end %> - -
- <%= submit "Save" %> -
-<% end %> diff --git a/lib/philomena_web/templates/tag/new.html.eex b/lib/philomena_web/templates/tag/new.html.eex deleted file mode 100644 index 51af2aa9..00000000 --- a/lib/philomena_web/templates/tag/new.html.eex +++ /dev/null @@ -1,5 +0,0 @@ -

New Tag

- -<%= render "form.html", Map.put(assigns, :action, Routes.tag_path(@conn, :create)) %> - -<%= link "Back", to: Routes.tag_path(@conn, :index) %> diff --git a/lib/philomena_web/views/comment_view.ex b/lib/philomena_web/views/comment_view.ex deleted file mode 100644 index fbe88c11..00000000 --- a/lib/philomena_web/views/comment_view.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule PhilomenaWeb.CommentView do - use PhilomenaWeb, :view -end