Updating style and ordering of user index
This commit is contained in:
parent
7193ec832c
commit
e9c648d36e
|
@ -1,4 +1,6 @@
|
||||||
// Place all the styles related to the users controller here.
|
// Place all the styles related to the users controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
|
|
||||||
|
.iconinfo, .hoverinfo { font-size: 1.5em; }
|
||||||
.hoverinfo { cursor: progress; }
|
.hoverinfo { cursor: progress; }
|
||||||
|
|
|
@ -15,7 +15,7 @@ class UsersController < ApplicationController
|
||||||
when "waiver"
|
when "waiver"
|
||||||
@users = @users.sort_by{ |u| [-u.waiver.to_i,u.name] }
|
@users = @users.sort_by{ |u| [-u.waiver.to_i,u.name] }
|
||||||
when "member"
|
when "member"
|
||||||
@users = @users.sort_by{ |u| [-u.member.to_i,u.name] }
|
@users = @users.sort_by{ |u| [-u.member.to_i,-u.member_level.to_i,u.name] }
|
||||||
when "card"
|
when "card"
|
||||||
@users = @users.sort_by{ |u| [-u.cards.count,u.name] }
|
@users = @users.sort_by{ |u| [-u.cards.count,u.name] }
|
||||||
when "instructor"
|
when "instructor"
|
||||||
|
|
|
@ -6,23 +6,40 @@ class User < ActiveRecord::Base
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
:recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
||||||
# Setup accessible (or protected) attributes for your model
|
# 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 :cards
|
||||||
has_many :user_certifications
|
has_many :user_certifications
|
||||||
has_many :certifications, :through => :user_certifications
|
has_many :certifications, :through => :user_certifications
|
||||||
|
|
||||||
def member_status
|
def member_status
|
||||||
# 1 = inactive, show an X
|
output = ""
|
||||||
if self.member == 1 then
|
|
||||||
"<span class='hoverinfo' title='Inactive'>!!</span>"
|
if self.member_level.to_i >= 1 then
|
||||||
# 25 or higher is paying, show a check
|
output = "<span class='hoverinfo' title='Inactive'>◌</span>"
|
||||||
elsif self.member == 25 then
|
|
||||||
"<span class='hoverinfo' title='25'>✓</span>"
|
|
||||||
elsif self.member == 50 then
|
|
||||||
"<span class='hoverinfo' title='50'>✓</span>"
|
|
||||||
elsif self.member == 100 then
|
|
||||||
"<span class='hoverinfo' title='100'>✓</span>"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless self.member.nil? then
|
||||||
|
# 1 = inactive, show an X
|
||||||
|
if self.member >= 10 then
|
||||||
|
output = "<span class='hoverinfo' title='Volunteer'>◔</span>"
|
||||||
|
# 25 or higher is paying, show a check
|
||||||
|
end
|
||||||
|
if self.member >= 25 then
|
||||||
|
output = "<span class='hoverinfo' title='25'>◑</span>"
|
||||||
|
end
|
||||||
|
if self.member >= 50 then
|
||||||
|
output = "<span class='hoverinfo' title='50'>◕</span>"
|
||||||
|
end
|
||||||
|
if self.member >= 100 then
|
||||||
|
output = "<span class='hoverinfo' title='100'>●</span>"
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.member < self.member_level.to_i then
|
||||||
|
output = "<span class='hoverinfo' title='Lapsed'>✗</span>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,9 +42,9 @@
|
||||||
</td><% end %>
|
</td><% end %>
|
||||||
<td><%= unless user.waiver.blank? then raw("<span class='hoverinfo' title='"+user.waiver.strftime("%B %d %Y")+"'>✓</span>") end %></td>
|
<td><%= unless user.waiver.blank? then raw("<span class='hoverinfo' title='"+user.waiver.strftime("%B %d %Y")+"'>✓</span>") end %></td>
|
||||||
<td><%= raw(user.member_status) %></td>
|
<td><%= raw(user.member_status) %></td>
|
||||||
<td><%= unless user.cards.blank? then raw("✓") end %></td>
|
<td><%= unless user.cards.blank? then raw("<span class='iconinfo'>✓</span>") end %></td>
|
||||||
<td><%= if user.instructor? then raw("✓") end %></td>
|
<td><%= if user.instructor? then raw("<span class='iconinfo'>✓</a>") end %></td>
|
||||||
<td><%= if user.admin? then raw("✓") end %></td>
|
<td><%= if user.admin? then raw("<span class='iconinfo'>✓</a>") end %></td>
|
||||||
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
|
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
|
||||||
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, user %></td>
|
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, user %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user