mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
unique tags in autocomplete
This commit is contained in:
parent
41f144b32b
commit
53ad9dd139
1 changed files with 1 additions and 0 deletions
|
@ -29,6 +29,7 @@ defmodule PhilomenaWeb.Tag.AutocompleteController do
|
||||||
Tag |> preload(:aliased_tag)
|
Tag |> preload(:aliased_tag)
|
||||||
)
|
)
|
||||||
|> Enum.map(&(&1.aliased_tag || &1))
|
|> Enum.map(&(&1.aliased_tag || &1))
|
||||||
|
|> Enum.uniq_by(&(&1.id))
|
||||||
|> Enum.sort_by(&(-&1.images_count))
|
|> Enum.sort_by(&(-&1.images_count))
|
||||||
|> Enum.map(&%{label: "#{&1.name} (#{&1.images_count})", value: &1.name})
|
|> Enum.map(&%{label: "#{&1.name} (#{&1.images_count})", value: &1.name})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue