denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyCMS/app/views/shinycms/admin/includes/_admin_toolbar.html.erb

Summary

Maintainability
Test Coverage
<nav class="shinycms-admin-toolbar">
  <%= link_to image_tag( 'shinycms/admin-toolbar/logo.png', alt: 'ShinyCMS' ), 'http://shinycms.org/' %>

  <div class="shinycms-admin-toolbar-links">

<% plugin_name = controller.class.name.split('::').first %>

<% plugins_with_admin_toolbar_templates.each do |plugin| %>
  <%= render partial: plugin.partial( 'admin/toolbar/section' ), locals: { plugin_name: plugin_name } %>
<% end %>

<% if controller_name == 'users' || controller_name == 'profiles' %>
  <%= component 'toolbar/users', admin_user: current_user, user_id: @profile&.user_id %>
<% end %>

<% if @discussion.present? %>
  <%= component 'toolbar/discussions', admin_user: current_user, discussion: @discussion %>
<% end %>

  <% if Rails.env.development? %>
    <%= link_to t( 'shinycms.admin.letter_opener_web' ), shinycms.letter_opener_web_path %>
    |
  <% end %>
  <% if current_user_can? :view_admin_area %>
    <%= link_to t( 'shinycms.admin.toolbar' ), shinycms.admin_path %>
  <% end %>
  </div>
</nav>