LafayetteCollegeLibraries/spot

View on GitHub
app/views/_user_util_links.html.erb

Summary

Maintainability
Test Coverage
<ul id="user_utility_links" class="nav navbar-nav navbar-right">
  <%#
    hyrax has the available locales hardcoded, as opposed to using the options available.
    i'm removing the picker for now just because we only have the community-provided
    options which we need to flesh out for our own app.
  %>
  <%# render 'shared/locale_picker' if available_translations.size > 1 %>

  <% if user_signed_in? %>
    <% if current_user.can?(:read, :dashboard) %>
    <li>
      <%= render_notifications(user: current_user) %>
    </li>
    <% end %>
    <li class="dropdown">
      <%= link_to hyrax.dashboard_profile_path(current_user), role: 'button', data: { toggle: 'dropdown' }, aria: { haspopup: true, expanded: false, controls: 'user-util-links' } do %>
        <span class="sr-only"><%= t("hyrax.toolbar.profile.sr_action") %></span>
        <span class="hidden-xs">&nbsp;<%= current_user.name %></span>
        <span class="sr-only"> <%= t("hyrax.toolbar.profile.sr_target") %></span>
        <span class="fa fa-user" aria-hidden="true"></span>
        <span class="caret"></span>
      <% end %>
      <ul id="user-util-links" class="dropdown-menu dropdown-menu-right" role="menu">
        <% if current_user.can?(:read, :dashboard) %>
        <li><%= link_to t("hyrax.toolbar.dashboard.menu"), hyrax.dashboard_path %></li>

        <li class="divider"></li>
        <% end %>
        <li><%= link_to t("hyrax.toolbar.profile.logout"), main_app.destroy_user_session_path %></li>
      </ul>
    </li><!-- /.btn-group -->
  <% else %>
    <li>
      <%= link_to main_app.new_user_session_path do %>
        <span class="glyphicon glyphicon-log-in"></span>
        <%= t('spot.log_in') %>
      <% end %>
    </li>
  <% end %>
</ul>