denny/ShinyCMS-ruby

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

Summary

Maintainability
Test Coverage
<br>
<table class="table table-responsive-sm table-striped">
  <tr>
    <th colspan="6">
      <a class="collapse-toggle" role="button" href="#" data-toggle="collapse" data-target=".collapse_capabilities" aria-expanded="true" aria-controls="collapse_capabilities">
        <%= t( 'shinycms.capability.capabilities' ) %>
        <% if @user.capabilities.present? %>
        <% show = 'show ' %>
        <span class="collapse show">
          <i class="cil-chevron-right"></i>
        </span>
        <% else %>
        <% show = '' %>
        <span class="collapse">
          <i class="cil-chevron-bottom"></i>
        </span>
        <% end %>
      </a>
    </th>
  </tr>

  <% category = capability_category( :general ) %>
  <% category_capabilities = %w[ view_admin_area view_admin_toolbar skip skip skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :tools ) %>
  <% category_capabilities = %w[ use_blazer use_sidekiq_web use_rails_email_preview use_letter_opener_web use_coverband ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% plugins_for_edit_capabilities.each do |plugin| %>
    <%= render partial: plugin.partial( 'admin/user/edit_capabilities' ), locals: { f: f, show: show } %>
  <% end %>

  <% category = capability_category( :discussions ) %>
  <% category_capabilities = %w[ show hide lock unlock skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :comments ) %>
  <% category_capabilities = %w[ show hide lock unlock destroy ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :spam_comments ) %>
  <% category_capabilities = %w[ list add skip destroy skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :mailer_previews ) %>
  <% category_capabilities = %w[ list show skip skip skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :email_recipients ) %>
  <% category_capabilities = %w[ list skip edit destroy skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :users ) %>
  <% category_capabilities = %w[ list add edit destroy view_admin_notes ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :admin_users ) %>
  <% category_capabilities = %w[ list add edit destroy skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :stats ) %>
  <% category_capabilities = %w[ view_web view_email use_blazer skip skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :settings ) %>
  <% category_capabilities = %w[ list skip edit skip skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>

  <% category = capability_category( :feature_flags ) %>
  <% category_capabilities = %w[ list skip edit skip skip ] %>
  <%= render_capability_category( f, category, category_capabilities, show ) %>
</table>