<%= @redaction.description.to_html %>
</div>
-<% if current_user and current_user.moderator? %>
+<% if can?(:edit, Redaction) || can?(:destroy, Redaction) %>
<div class="buttons">
- <%= button_to t(".edit"), edit_redaction_path(@redaction), :method => :get %></td>
- <%= button_to t(".destroy"), @redaction, :method => "delete", :remote => true, :data => { :confirm => t(".confirm") } %>
+ <% if can?(:edit, Redaction) %>
+ <%= button_to t(".edit"), edit_redaction_path(@redaction), :method => :get %></td>
+ <% end %>
+ <% if can?(:destroy, Redaction) %>
+ <%= button_to t(".destroy"), @redaction, :method => "delete", :remote => true, :data => { :confirm => t(".confirm") } %>
+ <% end %>
</div>
<% end %>
<% end %>
<% unless @user_blocks.empty? %>
-<%= render :partial => "blocks", :locals => { :show_revoke_link => (current_user && current_user.moderator?), :show_user_name => true, :show_creator_name => false } %>
+<%= render :partial => "blocks", :locals => { :show_revoke_link => can?(:revoke, UserBlock), :show_user_name => true, :show_creator_name => false } %>
<% else %>
<p><%= t ".empty", :name => h(@user.display_name) %></p>
<% end %>
<h1><%= raw(t(".heading", :name => link_to(h(@user.display_name), user_path(@user)))) %></h1>
<% end %>
<% unless @user_blocks.empty? %>
-<%= render :partial => "blocks", :locals => { :show_revoke_link => (current_user && current_user.moderator?), :show_user_name => false, :show_creator_name => true } %>
+<%= render :partial => "blocks", :locals => { :show_revoke_link => can?(:revoke, UserBlock), :show_user_name => false, :show_creator_name => true } %>
<% else %>
<p><%= t ".empty", :name => h(@user.display_name) %></p>
<% end %>
<% end %>
<% unless @user_blocks.empty? %>
-<%= render :partial => "blocks", :locals => { :show_revoke_link => (current_user && current_user.moderator?), :show_user_name => true, :show_creator_name => true } %>
+<%= render :partial => "blocks", :locals => { :show_revoke_link => can?(:revoke, UserBlock), :show_user_name => true, :show_creator_name => true } %>
<% else %>
<p><%= t ".empty" %></p>
<% end %>
<% if current_user and current_user.id == @user_block.creator_id %>
<li><%= link_to t(".edit"), edit_user_block_path(@user_block) %></li>
<% end %>
- <% if current_user and current_user.moderator? %>
+ <% if can?(:revoke, UserBlock) %>
<li><%= link_to(t(".revoke"), :controller => "user_blocks", :action => "revoke", :id => @user_block.id) %></li>
<% end %>
<% end %>
</li>
<% end %>
- <% if current_user and current_user.moderator? and current_user.blocks_created.exists? %>
+ <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
<li>
<%= link_to t(".blocks by me"), :controller => "user_blocks", :action => "blocks_by", :display_name => current_user.display_name %>
<span class='count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
</li>
<% end %>
- <% if current_user and current_user.moderator? %>
+ <% if can?(:create, UserBlock) %>
<li>
<%= link_to t(".create_block"), :controller => "user_blocks", :action => "new", :display_name => @user.display_name %>
</li>