Updating style and ordering of user index

This commit is contained in:
2013-01-25 21:11:01 -07:00
parent 7193ec832c
commit e9c648d36e
4 changed files with 34 additions and 15 deletions

View File

@@ -6,23 +6,40 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications, :hidden
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications, :hidden #TODO: make admin/instructor/member/etc not accessible
has_many :cards
has_many :user_certifications
has_many :certifications, :through => :user_certifications
def member_status
# 1 = inactive, show an X
if self.member == 1 then
"<span class='hoverinfo' title='Inactive'>!!</span>"
# 25 or higher is paying, show a check
elsif self.member == 25 then
"<span class='hoverinfo' title='25'>&#x2713;</span>"
elsif self.member == 50 then
"<span class='hoverinfo' title='50'>&#x2713;</span>"
elsif self.member == 100 then
"<span class='hoverinfo' title='100'>&#x2713;</span>"
output = ""
if self.member_level.to_i >= 1 then
output = "<span class='hoverinfo' title='Inactive'>&#9676;</span>"
end
unless self.member.nil? then
# 1 = inactive, show an X
if self.member >= 10 then
output = "<span class='hoverinfo' title='Volunteer'>&#9684;</span>"
# 25 or higher is paying, show a check
end
if self.member >= 25 then
output = "<span class='hoverinfo' title='25'>&#9681;</span>"
end
if self.member >= 50 then
output = "<span class='hoverinfo' title='50'>&#9685;</span>"
end
if self.member >= 100 then
output = "<span class='hoverinfo' title='100'>&#9679;</span>"
end
if self.member < self.member_level.to_i then
output = "<span class='hoverinfo' title='Lapsed'>&#x2717;</span>"
end
end
return output
end
end