mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
21 lines
385 B
Elixir
21 lines
385 B
Elixir
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
|
|
|
|
def first_badge_label([]) do
|
|
nil
|
|
end
|
|
|
|
def first_badge_label([badge | _rest]) do
|
|
badge[:data][:set_value]
|
|
end
|
|
end
|