Sha256: d0d6b6e39f5438333811a74e6706b9d5c23d137e521e531122db70ae321e649a

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

<% show_dropdown = (Trestle.config.auth.user_admin && Trestle.lookup(Trestle.config.auth.user_admin)) || Trestle.config.auth.enable_logout %>

<div class="userbox<% if show_dropdown %> dropdown<% end %>">
  <% content = capture do %>
    <span class="name<% if show_dropdown %> dropdown-toggle<% end %>">
      <%= format_user_name(current_user) %>
    </span>

    <%= avatar_for(current_user) %>
  <% end %>

  <% if show_dropdown %>
    <%= link_to content, "#", data: { toggle: 'dropdown' } %>
  <% else %>
    <%= content %>
  <% end %>

  <% if show_dropdown -%>
  <ul class="dropdown-menu dropdown-menu-right">
    <% if Trestle.config.auth.user_admin && user_admin = Trestle.lookup(Trestle.config.auth.user_admin) -%>
      <li><%= admin_link_to t("admin.auth.my_account", default: "My Account"), current_user, admin: user_admin, class: "dropdown-item" %></li>
    <% end -%>
    <% if Trestle.config.auth.enable_logout -%>
      <li><%= link_to t("admin.auth.logout", default: "Log out"), trestle.logout_path, class: "dropdown-item" %></li>
    <% end -%>
  </ul>
  <% end %>
</div>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trestle-auth-0.4.4 app/views/trestle/auth/_userbox.html.erb
trestle-auth-0.4.3 app/views/trestle/auth/_userbox.html.erb
trestle-auth-0.4.2 app/views/trestle/auth/_userbox.html.erb
trestle-auth-0.4.1 app/views/trestle/auth/_userbox.html.erb
trestle-auth-0.4.0 app/views/trestle/auth/_userbox.html.erb