mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
fix award titles
This commit is contained in:
parent
9f0a8470e4
commit
161de00bfa
2 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue