Recreated user forms, updated abilities, linked cards and users

This commit is contained in:
2012-10-14 06:23:35 -07:00
parent 0254f9aa2c
commit d1ef1e7db9
12 changed files with 204 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
<h1>Listing cards</h1>
<%= link_to 'New Card', new_card_path %>
<%= link_to 'Upload all cards', upload_all_path %>
<%= link_to 'New Card', new_card_path if can? :create, Card %>
<%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %>
<table>
<tr>
<th>User</th>
@@ -22,9 +22,9 @@
<td><%= card.id %></td>
<td><%= card.card_number %></td>
<td><%= if card.card_permissions == 1 then "Access" end %></td>
<td><%= link_to 'Upload', upload_path(card) %></td>
<td><%= link_to 'Edit', edit_card_path(card) %></td>
<td><%= link_to 'Destroy', card, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE CARD FROM THE DOOR SYSTEM! DISABLE AND UPLOAD IT FIRST.', :method => :delete %></td>
<td><%= link_to 'Upload', upload_path(card) if can? :upload, card %></td>
<td><%= link_to 'Edit', edit_card_path(card) if can? :update, card %></td>
<td><%= link_to 'Destroy', card, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE CARD FROM THE DOOR SYSTEM! DISABLE AND UPLOAD IT FIRST.', :method => :delete if can? :destroy, card %></td>
</tr>
<% end %>
<% end %>

View File

@@ -1,6 +1,6 @@
<p>
<b>Name:</b>
<b>Card Note:</b>
<%= @card.name %>
</p>
@@ -19,6 +19,6 @@
<%= @card.card_permissions %>
</p>
<%= link_to 'Upload to Door', upload_path(@card) %>
<%= link_to 'Upload to Door', upload_path(@card) if can? :upload, @card %>
<%= link_to 'Edit', edit_card_path(@card) %> |
<%= link_to 'Back', cards_path %>

View File

@@ -2,12 +2,12 @@
<% if @upload_result %>
<p>
<b>Upload result:</b>
<%= @card.name %> uploaded successfully.
<%= @card.card_number %> uploaded successfully.
</p>
<% else %>
<p>
<b>Upload result:</b>
Error uploading <%= @card.name %>.
Error uploading <%= @card.card_number %>.
</p>
<% end %>