2022-12-20 16:05:26 +01:00
|
|
|
module MembersHelper
|
2023-01-11 17:20:21 +01:00
|
|
|
|
2023-01-28 15:00:36 +01:00
|
|
|
def picture_for(someone , classes = "")
|
2023-01-11 17:20:21 +01:00
|
|
|
if someone.picture.blank?
|
2023-01-12 21:24:36 +01:00
|
|
|
image = asset_url("no_image.png")
|
2023-01-11 17:20:21 +01:00
|
|
|
else
|
2023-01-11 19:52:58 +01:00
|
|
|
image = someone.picture.url
|
2023-01-11 17:20:21 +01:00
|
|
|
end
|
2023-01-25 21:15:54 +01:00
|
|
|
if someone.respond_to? :name
|
|
|
|
alt = someone.name
|
|
|
|
else
|
|
|
|
alt = ""
|
|
|
|
end
|
|
|
|
image_tag(image , alt: alt , class: classes )
|
2023-01-11 17:20:21 +01:00
|
|
|
end
|
|
|
|
|
2023-01-12 13:56:50 +01:00
|
|
|
def stayed(member)
|
2023-06-18 10:23:46 +02:00
|
|
|
return "Not arrived" if member.arriving.blank?
|
|
|
|
text = member.arriving.to_s
|
|
|
|
return text + " not left" if member.leaving.blank?
|
|
|
|
text + " " + distance_of_time_in_words( member.leaving , member.arriving)
|
2023-01-12 13:56:50 +01:00
|
|
|
end
|
2022-12-20 16:05:26 +01:00
|
|
|
end
|