fix award titles

This commit is contained in:
byte[] 2019-11-11 20:40:31 -05:00
parent 9f0a8470e4
commit 161de00bfa
2 changed files with 8 additions and 1 deletions

View file

@ -46,7 +46,7 @@
.flex__grow.center
.badge = badge_image(award.badge, alt: award.label, width: "32", height: "32")
br
= (award.badge_name || award.badge.title)
= award_title(award)
.flex__grow.center
= pretty_time(award.awarded_on)

View file

@ -10,6 +10,13 @@ defmodule PhilomenaWeb.ProfileView do
img_tag(badge_url_root() <> "/" <> badge.image, options)
end
def award_title(%{badge_name: nil} = award),
do: award.badge.title
def award_title(%{badge_name: ""} = award),
do: award.badge.title
def award_title(award),
do: award.badge_name
defp badge_url_root do
Application.get_env(:philomena, :badge_url_root)
end