From 962c681c8e8a2268ca66dbb2b24a0f972e3642f3 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 18 Aug 2019 14:35:10 -0400 Subject: [PATCH] slightly better tag listing --- lib/philomena/tags.ex | 2 +- .../templates/tag/_tag_list.html.slime | 5 ++-- .../templates/tag/index.html.eex | 24 ------------------- .../templates/tag/index.html.slime | 1 + 4 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 lib/philomena_web/templates/tag/index.html.eex create mode 100644 lib/philomena_web/templates/tag/index.html.slime diff --git a/lib/philomena/tags.ex b/lib/philomena/tags.ex index 846866c3..00385fda 100644 --- a/lib/philomena/tags.ex +++ b/lib/philomena/tags.ex @@ -18,7 +18,7 @@ defmodule Philomena.Tags do """ def list_tags do - Repo.all(Tag) + Repo.all(Tag |> order_by(desc: :images_count) |> limit(250)) end @doc """ diff --git a/lib/philomena_web/templates/tag/_tag_list.html.slime b/lib/philomena_web/templates/tag/_tag_list.html.slime index 0798b1c3..42d4ddb4 100644 --- a/lib/philomena_web/templates/tag/_tag_list.html.slime +++ b/lib/philomena_web/templates/tag/_tag_list.html.slime @@ -1,2 +1,3 @@ -= for tag <- @tags do - = render PhilomenaWeb.TagView, "_tag.html", tag: tag \ No newline at end of file +.tag-list + = for tag <- @tags do + = render PhilomenaWeb.TagView, "_tag.html", tag: tag \ No newline at end of file diff --git a/lib/philomena_web/templates/tag/index.html.eex b/lib/philomena_web/templates/tag/index.html.eex deleted file mode 100644 index 51086582..00000000 --- a/lib/philomena_web/templates/tag/index.html.eex +++ /dev/null @@ -1,24 +0,0 @@ -

Listing Tags

- - - - - - - - - -<%= for tag <- @tags do %> - - - - -<% end %> - -
- <%= link "Show", to: Routes.tag_path(@conn, :show, tag) %> - <%= link "Edit", to: Routes.tag_path(@conn, :edit, tag) %> - <%= link "Delete", to: Routes.tag_path(@conn, :delete, tag), method: :delete, data: [confirm: "Are you sure?"] %> -
- -<%= link "New Tag", to: Routes.tag_path(@conn, :new) %> diff --git a/lib/philomena_web/templates/tag/index.html.slime b/lib/philomena_web/templates/tag/index.html.slime new file mode 100644 index 00000000..4fb7b874 --- /dev/null +++ b/lib/philomena_web/templates/tag/index.html.slime @@ -0,0 +1 @@ += render PhilomenaWeb.TagView, "_tag_list.html", tags: @tags \ No newline at end of file