Adding status symbols
This commit is contained in:
parent
59b6e3c838
commit
4dba2b8c3d
|
@ -122,35 +122,50 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def member_status_symbol
|
||||
# Begin output buffer
|
||||
message = ""
|
||||
icon = ""
|
||||
flair = ""
|
||||
|
||||
# First status item is level
|
||||
case self.member_level.to_i
|
||||
when 0
|
||||
when 0..9
|
||||
if self.payments.count > 0 then
|
||||
"<span class='hoverinfo' title='Former Member (#{(DateTime.now - self.payments.last.date).to_i} days ago)'>:(</span>"
|
||||
message = "Former Member (#{(DateTime.now - self.payments.last.date).to_i} days ago)"
|
||||
icon = :timeout
|
||||
else
|
||||
"<!-- Not a member -->"
|
||||
message = "Not a Member"
|
||||
icon = :no
|
||||
end
|
||||
when 1
|
||||
"Unable"
|
||||
when 10..24
|
||||
"<span class='hoverinfo' title='Volunteer'>◔</span>"
|
||||
message = "Volunteer"
|
||||
icon = :heart
|
||||
when 25..49
|
||||
message = member_level_string
|
||||
icon = :copper
|
||||
when 50..99
|
||||
message = member_level_string
|
||||
icon = :silver
|
||||
when 100..999
|
||||
message = member_level_string
|
||||
icon = :gold
|
||||
end
|
||||
|
||||
# Second status item is payment status
|
||||
case self.member_level.to_i
|
||||
when 25..999
|
||||
# There are payments
|
||||
if self.payments.count > 0 then
|
||||
if self.payments.last.date < (DateTime.now - 45.days)
|
||||
"<span class='hoverinfo' title='Recently Lapsed (#{(DateTime.now - self.payments.last.date).to_i} days ago)'>◌</span>"
|
||||
# They're on time
|
||||
if self.payments.last.date > (DateTime.now - 45.days)
|
||||
flair = "-paid"
|
||||
else
|
||||
case self.member_level.to_i
|
||||
when 25..49
|
||||
"<span class='hoverinfo' title='#{member_level_string}'>◑</span>"
|
||||
when 50..99
|
||||
"<span class='hoverinfo' title='#{member_level_string}'>◕</span>"
|
||||
when 100..999
|
||||
"<span class='hoverinfo' title='#{member_level_string}'>●</span>"
|
||||
end
|
||||
message = "Last Payment (#{(DateTime.now - self.payments.last.date).to_i} days ago)"
|
||||
end
|
||||
else
|
||||
"<span class='hoverinfo' title='No Payments'>?</span>"
|
||||
end
|
||||
end
|
||||
|
||||
return "<img src='#{icon}#{flair}-coin.png' title='#{message}' />"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
BIN
public/copper-paid-coin.png
Normal file
BIN
public/copper-paid-coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
public/gold-paid-coin.png
Normal file
BIN
public/gold-paid-coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
public/heart-coin.png
Normal file
BIN
public/heart-coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
public/no-coin.png
Normal file
BIN
public/no-coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
public/silver-paid-coin.png
Normal file
BIN
public/silver-paid-coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
public/timeout-coin.png
Normal file
BIN
public/timeout-coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in New Issue
Block a user