mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-21 12:53:11 +01:00
various fixes
This commit is contained in:
parent
bbad33a70c
commit
c41c99992d
3 changed files with 16 additions and 16 deletions
|
@ -2,7 +2,7 @@ elixir:
|
||||||
tabs = Enum.with_index(@data["tabs"])
|
tabs = Enum.with_index(@data["tabs"])
|
||||||
tab_modes = @data["tab_modes"]
|
tab_modes = @data["tab_modes"]
|
||||||
|
|
||||||
.block__header--sub.block__header--js--tabbed
|
.block__header--sub.block__header--js-tabbed
|
||||||
= for {name, i} <- tabs do
|
= for {name, i} <- tabs do
|
||||||
= link name, to: "#", class: tab_class(i), data: [click_tab: name]
|
= link name, to: "#", class: tab_class(i), data: [click_tab: name]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
= for slice <- Enum.chunk_every(@shipping[@tab], 10) do
|
= for slice <- Enum.chunk_every(@shipping[@tab], 10) do
|
||||||
div
|
div
|
||||||
= for tag_name <- slice do
|
= for tag <- slice do
|
||||||
= tag_link @tags[tag_name], tag_name
|
= tag_link tag, tag.name
|
||||||
br
|
br
|
|
@ -2,7 +2,6 @@ defmodule PhilomenaWeb.TagView do
|
||||||
use PhilomenaWeb, :view
|
use PhilomenaWeb, :view
|
||||||
|
|
||||||
# this is bad practice, don't copy this.
|
# this is bad practice, don't copy this.
|
||||||
alias Philomena.Tags.Implication
|
|
||||||
alias Philomena.Tags.Tag
|
alias Philomena.Tags.Tag
|
||||||
alias Philomena.Repo
|
alias Philomena.Repo
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
@ -104,17 +103,18 @@ defmodule PhilomenaWeb.TagView do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp implied_by_multitag(tag_names, ignore_tag_names) do
|
defp implied_by_multitag(tag_names, ignore_tag_names) do
|
||||||
query =
|
Tag.search_records(
|
||||||
from t in Tag,
|
%{
|
||||||
left_join: i in Implication,
|
query: %{
|
||||||
on: t.id == i.tag_id,
|
bool: %{
|
||||||
left_join: it in Tag,
|
must: Enum.map(tag_names, &%{term: %{implied_tags: &1}}),
|
||||||
on: it.id == i.implied_tag_id,
|
must_not: Enum.map(ignore_tag_names, &%{term: %{implied_tags: &1}}),
|
||||||
where: it.name in ^tag_names and it.name not in ^ignore_tag_names,
|
}
|
||||||
order_by: [desc: t.images_count],
|
},
|
||||||
preload: :implied_tags,
|
sort: %{images: :desc}
|
||||||
limit: 40
|
},
|
||||||
|
%{page_size: 40},
|
||||||
Repo.all(query)
|
Tag
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue