15 lines
387 B
Ruby
15 lines
387 B
Ruby
module MoodsHelper
|
|
def mode_for(mood, user)
|
|
if user.guess?
|
|
mood[:mode] || mood[:guess] || { label: "unknown", color: "white" }
|
|
else
|
|
mood[:mode] || { label: "unknown", color: "white" }
|
|
end
|
|
end
|
|
|
|
def style_for_mode(mode)
|
|
style = "background-color: #{mode[:color]};"
|
|
style += " border: 2px double grey;" if mode[:label] == "unknown"
|
|
style
|
|
end
|
|
end
|