Allowing nil waiver/orientation dates, adjusting permissions of users

This commit is contained in:
Will Bradley 2013-01-25 01:49:32 -07:00
parent d44ae6a69f
commit fe283b051f
3 changed files with 8 additions and 6 deletions

View File

@ -6,7 +6,7 @@ class Ability
if user.admin? if user.admin?
can :manage, :all can :manage, :all
else else
can :read, User, :id => user.id can :read, User
can :read, Card, :user_id => user.id can :read, Card, :user_id => user.id
end end
end end

View File

@ -21,11 +21,11 @@
</div> </div>
<div class="field"> <div class="field">
<%= f.label :waiver %><br /> <%= f.label :waiver %><br />
<%= f.date_select :waiver %> <%= f.date_select :waiver, :include_blank => 'true', :default => 'nil' %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :orientation %><br /> <%= f.label :orientation %><br />
<%= f.date_select :orientation %> <%= f.date_select :orientation, :include_blank => 'true', :default => 'nil' %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :emergency_name %><br /> <%= f.label :emergency_name %><br />

View File

@ -7,7 +7,9 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Email</th> <th>Email</th>
<th>Cards</th> <% if current_user.admin? then %>
<th>Cards</th>
<% end %>
<th>Active?</th> <th>Active?</th>
<th>Waiver?</th> <th>Waiver?</th>
<th>Admin?</th> <th>Admin?</th>
@ -20,11 +22,11 @@
<tr> <tr>
<td><%= user.name %></td> <td><%= user.name %></td>
<td><%= user.email %></td> <td><%= user.email %></td>
<td> <% if current_user.admin? then %><td>
<% user.cards.each do |c| %> <% user.cards.each do |c| %>
<%= link_to c.card_number, card_url(c) %><%= "," unless c == user.cards.last %> <%= link_to c.card_number, card_url(c) %><%= "," unless c == user.cards.last %>
<% end %> <% end %>
</td> </td><% end %>
<td><%= if user.active? then "Active" end %></td> <td><%= if user.active? then "Active" end %></td>
<td><%= if user.waiver.blank? then "Not Signed" else "Signed" end %></td> <td><%= if user.waiver.blank? then "Not Signed" else "Signed" end %></td>
<td><%= if user.admin? then "Admin" end %></td> <td><%= if user.admin? then "Admin" end %></td>