philomena/lib/philomena_web/views/profile/award_view.ex

22 lines
385 B
Elixir
Raw Normal View History

2019-12-15 21:02:13 +01:00
defmodule PhilomenaWeb.Profile.AwardView do
use PhilomenaWeb, :view
def badge_options(badges) do
for badge <- badges do
[
key: badge.title,
value: badge.id,
data: [set_value: badge.description]
]
end
end
2020-09-15 02:12:27 +02:00
def first_badge_label([]) do
nil
end
def first_badge_label([badge | _rest]) do
badge[:data][:set_value]
end
2019-12-15 21:02:13 +01:00
end