mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
don't show extra tag info if there is no extra info
This commit is contained in:
parent
c3f745ddee
commit
16d9282246
3 changed files with 38 additions and 35 deletions
|
@ -25,45 +25,46 @@
|
||||||
= Enum.map_join(@tag.implied_tags, ", ", & &1.name)
|
= Enum.map_join(@tag.implied_tags, ", ", & &1.name)
|
||||||
br
|
br
|
||||||
|
|
||||||
br
|
= if present?(@tag.public_links) or present?(@tag.implied_by_tags) or present?(@tag.description) do
|
||||||
= link "Toggle detailed information", to: "#", data: [click_toggle: ".tag-info__more"]
|
br
|
||||||
|
= link "Toggle detailed information", to: "#", data: [click_toggle: ".tag-info__more"]
|
||||||
|
|
||||||
.tag-info__more
|
.tag-info__more
|
||||||
hr
|
hr
|
||||||
|
|
||||||
= if Enum.any?(@tag.public_links) do
|
= if Enum.any?(@tag.public_links) do
|
||||||
strong> Associated links:
|
strong> Associated links:
|
||||||
|
|
||||||
= for link <- @tag.public_links do
|
= for link <- @tag.public_links do
|
||||||
a> href=link.uri = link.uri
|
a> href=link.uri = link.uri
|
||||||
|
|
||||||
br
|
br
|
||||||
|
|
||||||
= if Enum.any?(@tag.public_links) do
|
= if Enum.any?(@tag.public_links) do
|
||||||
strong> Associated users:
|
strong> Associated users:
|
||||||
- users = Enum.map(@tag.public_links, & &1.user) |> Enum.uniq()
|
- users = Enum.map(@tag.public_links, & &1.user) |> Enum.uniq()
|
||||||
|
|
||||||
= for user <- users do
|
= for user <- users do
|
||||||
=> link user.name, to: Routes.profile_path(@conn, :show, user)
|
=> link user.name, to: Routes.profile_path(@conn, :show, user)
|
||||||
|
|
||||||
br
|
br
|
||||||
|
|
||||||
= if Enum.any?(@tag.implied_by_tags) do
|
= if Enum.any?(@tag.implied_by_tags) do
|
||||||
input.toggle-box id="implied_by" type="checkbox" checked="false"
|
input.toggle-box id="implied_by" type="checkbox" checked="false"
|
||||||
label for="implied_by"
|
label for="implied_by"
|
||||||
' Implied by (warning: unfiltered)
|
' Implied by (warning: unfiltered)
|
||||||
|
|
||||||
.toggle-box-container
|
.toggle-box-container
|
||||||
.toggle-box-container__content
|
.toggle-box-container__content
|
||||||
= for tag <- @tag.implied_by_tags do
|
= for tag <- @tag.implied_by_tags do
|
||||||
=> link tag.name, to: Routes.tag_path(@conn, :show, tag)
|
=> link tag.name, to: Routes.tag_path(@conn, :show, tag)
|
||||||
|
|
||||||
br
|
br
|
||||||
|
|
||||||
= if @tag.description not in [nil, ""] do
|
= if @tag.description not in [nil, ""] do
|
||||||
strong> Detailed description:
|
strong> Detailed description:
|
||||||
br
|
br
|
||||||
== @body
|
== @body
|
||||||
|
|
||||||
= if Enum.any?(@dnp_entries) do
|
= if Enum.any?(@dnp_entries) do
|
||||||
hr
|
hr
|
||||||
|
|
|
@ -126,4 +126,13 @@ defmodule PhilomenaWeb.AppView do
|
||||||
def link_to_fingerprint(fp) do
|
def link_to_fingerprint(fp) do
|
||||||
link(String.slice(text_or_na(fp), 0..6), to: "#")
|
link(String.slice(text_or_na(fp), 0..6), to: "#")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def blank?(nil), do: true
|
||||||
|
def blank?(""), do: true
|
||||||
|
def blank?([]), do: true
|
||||||
|
def blank?(map) when is_map(map), do: map == %{}
|
||||||
|
def blank?(str) when is_binary(str), do: String.trim(str) == ""
|
||||||
|
def blank?(_object), do: false
|
||||||
|
|
||||||
|
def present?(object), do: not blank?(object)
|
||||||
end
|
end
|
||||||
|
|
|
@ -123,13 +123,6 @@ defmodule PhilomenaWeb.DuplicateReportView do
|
||||||
|> Enum.any?()
|
|> Enum.any?()
|
||||||
end
|
end
|
||||||
|
|
||||||
defp blank?(nil), do: true
|
|
||||||
defp blank?(""), do: true
|
|
||||||
defp blank?(str) when is_binary(str), do: String.trim(str) == ""
|
|
||||||
defp blank?(_object), do: false
|
|
||||||
|
|
||||||
defp present?(object), do: not blank?(object)
|
|
||||||
|
|
||||||
defp proper_subset?(set1, set2),
|
defp proper_subset?(set1, set2),
|
||||||
do: MapSet.subset?(set1, set2) and not MapSet.equal?(set1, set2)
|
do: MapSet.subset?(set1, set2) and not MapSet.equal?(set1, set2)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue