don't show extra tag info if there is no extra info

This commit is contained in:
byte[] 2019-12-07 18:53:24 -05:00
parent c3f745ddee
commit 16d9282246
3 changed files with 38 additions and 35 deletions

View file

@ -25,6 +25,7 @@
= Enum.map_join(@tag.implied_tags, ", ", & &1.name)
br
= if present?(@tag.public_links) or present?(@tag.implied_by_tags) or present?(@tag.description) do
br
= link "Toggle detailed information", to: "#", data: [click_toggle: ".tag-info__more"]

View file

@ -126,4 +126,13 @@ defmodule PhilomenaWeb.AppView do
def link_to_fingerprint(fp) do
link(String.slice(text_or_na(fp), 0..6), to: "#")
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

View file

@ -123,13 +123,6 @@ defmodule PhilomenaWeb.DuplicateReportView do
|> Enum.any?()
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),
do: MapSet.subset?(set1, set2) and not MapSet.equal?(set1, set2)
end