Adding status symbols

This commit is contained in:
Will Bradley 2013-08-26 23:39:54 -07:00
parent 59b6e3c838
commit 4dba2b8c3d
7 changed files with 33 additions and 18 deletions

View File

@ -122,37 +122,52 @@ class User < ActiveRecord::Base
end end
def member_status_symbol def member_status_symbol
# Begin output buffer
message = ""
icon = ""
flair = ""
# First status item is level
case self.member_level.to_i case self.member_level.to_i
when 0 when 0..9
if self.payments.count > 0 then 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 else
"<!-- Not a member -->" message = "Not a Member"
icon = :no
end end
when 1
"Unable"
when 10..24 when 10..24
"<span class='hoverinfo' title='Volunteer'>&#9684;</span>" message = "Volunteer"
when 25..999 icon = :heart
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)'>&#9676;</span>"
else
case self.member_level.to_i
when 25..49 when 25..49
"<span class='hoverinfo' title='#{member_level_string}'>&#9681;</span>" message = member_level_string
icon = :copper
when 50..99 when 50..99
"<span class='hoverinfo' title='#{member_level_string}'>&#9685;</span>" message = member_level_string
icon = :silver
when 100..999 when 100..999
"<span class='hoverinfo' title='#{member_level_string}'>&#9679;</span>" message = member_level_string
end icon = :gold
end 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
# They're on time
if self.payments.last.date > (DateTime.now - 45.days)
flair = "-paid"
else else
"<span class='hoverinfo' title='No Payments'>?</span>" message = "Last Payment (#{(DateTime.now - self.payments.last.date).to_i} days ago)"
end end
end end
end end
return "<img src='#{icon}#{flair}-coin.png' title='#{message}' />"
end
private private
def send_new_user_email def send_new_user_email

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB