mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +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
|
.flex__grow.center
|
||||||
.badge = badge_image(award.badge, alt: award.label, width: "32", height: "32")
|
.badge = badge_image(award.badge, alt: award.label, width: "32", height: "32")
|
||||||
br
|
br
|
||||||
= (award.badge_name || award.badge.title)
|
= award_title(award)
|
||||||
.flex__grow.center
|
.flex__grow.center
|
||||||
= pretty_time(award.awarded_on)
|
= pretty_time(award.awarded_on)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,13 @@ defmodule PhilomenaWeb.ProfileView do
|
||||||
img_tag(badge_url_root() <> "/" <> badge.image, options)
|
img_tag(badge_url_root() <> "/" <> badge.image, options)
|
||||||
end
|
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
|
defp badge_url_root do
|
||||||
Application.get_env(:philomena, :badge_url_root)
|
Application.get_env(:philomena, :badge_url_root)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue