diff --git a/lib/philomena_web/templates/tag/_quick_tag_table.html.slime b/lib/philomena_web/templates/tag/_quick_tag_table.html.slime index bd938942..ec3688e1 100644 --- a/lib/philomena_web/templates/tag/_quick_tag_table.html.slime +++ b/lib/philomena_web/templates/tag/_quick_tag_table.html.slime @@ -2,7 +2,7 @@ elixir: tabs = Enum.with_index(@data["tabs"]) tab_modes = @data["tab_modes"] -.block__header--sub.block__header--js--tabbed +.block__header--sub.block__header--js-tabbed = for {name, i} <- tabs do = link name, to: "#", class: tab_class(i), data: [click_tab: name] diff --git a/lib/philomena_web/templates/tag/_quick_tag_table_shipping.html.slime b/lib/philomena_web/templates/tag/_quick_tag_table_shipping.html.slime index b85f480a..85cc34a2 100644 --- a/lib/philomena_web/templates/tag/_quick_tag_table_shipping.html.slime +++ b/lib/philomena_web/templates/tag/_quick_tag_table_shipping.html.slime @@ -1,5 +1,5 @@ = for slice <- Enum.chunk_every(@shipping[@tab], 10) do div - = for tag_name <- slice do - = tag_link @tags[tag_name], tag_name + = for tag <- slice do + = tag_link tag, tag.name br \ No newline at end of file diff --git a/lib/philomena_web/views/tag_view.ex b/lib/philomena_web/views/tag_view.ex index 2388a4e4..b7c80ee1 100644 --- a/lib/philomena_web/views/tag_view.ex +++ b/lib/philomena_web/views/tag_view.ex @@ -2,7 +2,6 @@ defmodule PhilomenaWeb.TagView do use PhilomenaWeb, :view # this is bad practice, don't copy this. - alias Philomena.Tags.Implication alias Philomena.Tags.Tag alias Philomena.Repo import Ecto.Query @@ -104,17 +103,18 @@ defmodule PhilomenaWeb.TagView do end defp implied_by_multitag(tag_names, ignore_tag_names) do - query = - from t in Tag, - left_join: i in Implication, - on: t.id == i.tag_id, - left_join: it in Tag, - on: it.id == i.implied_tag_id, - where: it.name in ^tag_names and it.name not in ^ignore_tag_names, - order_by: [desc: t.images_count], - preload: :implied_tags, - limit: 40 - - Repo.all(query) + Tag.search_records( + %{ + query: %{ + bool: %{ + must: Enum.map(tag_names, &%{term: %{implied_tags: &1}}), + must_not: Enum.map(ignore_tag_names, &%{term: %{implied_tags: &1}}), + } + }, + sort: %{images: :desc} + }, + %{page_size: 40}, + Tag + ) end end