app/views/libraries/index.html.erb in enju_library-0.1.2 vs app/views/libraries/index.html.erb in enju_library-0.2.0.beta.1
- old
+ new
@@ -38,11 +38,11 @@
</tr>
<%- @libraries.each_with_index do |library, i| -%>
<tr class="line<%= cycle("0", "1") -%>">
<td>
- <%- if can?(:update, library) and params[:query].blank? -%>
+ <%- if policy(library).update? and params[:query].blank? -%>
<%= library.first? ? image_tag('icons/stop.png', size: '16x16') : link_to(image_tag('icons/arrow_up.png', size: '16x16', alt: t('page.asc')), {action: 'update', move: 'higher', id: library.name}, method: :put) -%>
<%= library.last? ? image_tag('icons/stop.png', size: '16x16') : link_to(image_tag('icons/arrow_down.png', size: '16x16', alt: t('page.desc')), {action: 'update', move: 'lower', id: library.name}, method: :put) -%>
<%- end -%>
</td>
<td><%= library.name -%></td>
@@ -64,14 +64,14 @@
<% if library.fax_number.present? %>
fax: <%= library.fax_number -%>
<% end %>
</td>
<td>
- <%- if can? :update, library -%>
+ <%- if policy(library).update? -%>
<%= link_to t('page.edit'), edit_library_path(library) -%>
<% end %>
- <%- if can? :delete, library -%>
+ <%- if policy(library).destroy? -%>
<%= link_to t('page.destroy'), library, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
<%- end -%>
</td>
</tr>
<%- end -%>
@@ -81,10 +81,10 @@
</div>
</div>
<div id="submenu" class="ui-corner-all ui-widget-content">
<ul>
- <%- if can? :create, Library -%>
+ <%- if policy(Library).create? -%>
<li><%= link_to t('page.new', model: t('activerecord.models.library')), new_library_path -%></li>
<%- end -%>
</ul>
</div>