diff --git a/lib/philomena_web/templates/tag/_tag_info_row.html.slime b/lib/philomena_web/templates/tag/_tag_info_row.html.slime index 033e3973..94b9a52b 100644 --- a/lib/philomena_web/templates/tag/_tag_info_row.html.slime +++ b/lib/philomena_web/templates/tag/_tag_info_row.html.slime @@ -25,45 +25,46 @@ = Enum.map_join(@tag.implied_tags, ", ", & &1.name) br - br - = link "Toggle detailed information", to: "#", data: [click_toggle: ".tag-info__more"] + = 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"] - .tag-info__more - hr + .tag-info__more + hr - = if Enum.any?(@tag.public_links) do - strong> Associated links: + = if Enum.any?(@tag.public_links) do + strong> Associated links: - = for link <- @tag.public_links do - a> href=link.uri = link.uri + = for link <- @tag.public_links do + a> href=link.uri = link.uri - br + br - = if Enum.any?(@tag.public_links) do - strong> Associated users: - - users = Enum.map(@tag.public_links, & &1.user) |> Enum.uniq() + = if Enum.any?(@tag.public_links) do + strong> Associated users: + - users = Enum.map(@tag.public_links, & &1.user) |> Enum.uniq() - = for user <- users do - => link user.name, to: Routes.profile_path(@conn, :show, user) + = for user <- users do + => link user.name, to: Routes.profile_path(@conn, :show, user) - br + br - = if Enum.any?(@tag.implied_by_tags) do - input.toggle-box id="implied_by" type="checkbox" checked="false" - label for="implied_by" - ' Implied by (warning: unfiltered) + = if Enum.any?(@tag.implied_by_tags) do + input.toggle-box id="implied_by" type="checkbox" checked="false" + label for="implied_by" + ' Implied by (warning: unfiltered) - .toggle-box-container - .toggle-box-container__content - = for tag <- @tag.implied_by_tags do - => link tag.name, to: Routes.tag_path(@conn, :show, tag) + .toggle-box-container + .toggle-box-container__content + = for tag <- @tag.implied_by_tags do + => link tag.name, to: Routes.tag_path(@conn, :show, tag) - br + br - = if @tag.description not in [nil, ""] do - strong> Detailed description: - br - == @body + = if @tag.description not in [nil, ""] do + strong> Detailed description: + br + == @body = if Enum.any?(@dnp_entries) do hr diff --git a/lib/philomena_web/views/app_view.ex b/lib/philomena_web/views/app_view.ex index 0ee1e69f..ca344c0e 100644 --- a/lib/philomena_web/views/app_view.ex +++ b/lib/philomena_web/views/app_view.ex @@ -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 diff --git a/lib/philomena_web/views/duplicate_report_view.ex b/lib/philomena_web/views/duplicate_report_view.ex index 974f31ab..59d09cfc 100644 --- a/lib/philomena_web/views/duplicate_report_view.ex +++ b/lib/philomena_web/views/duplicate_report_view.ex @@ -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