denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyCMS/app/views/shinycms/admin/users/_capability_checkbox.html.erb

Summary

Maintainability
Test Coverage
  <% c = capability( name: capability, category: category ) %>
  <% if c.present? %>
    <label>
      <% if @user.can?( c.name.to_sym, c.category.name.to_sym ) %>
      <input type="checkbox" name="user[capabilities[<%= c.id %>]]" checked="checked">
      <% else %>
      <input type="checkbox" name="user[capabilities[<%= c.id %>]]">
      <% end %>
      <% if I18n.exists?( "shinycms.capability.#{c.category.name}.#{c.name}" ) %>
      <%= t( "shinycms.capability.#{c.category.name}.#{c.name}" ) %>
      <% else %>
      <%= t( c.name ) %>
      <% end %>
    </label>
  <% end %>