Sha256: 8125708391135aedcda21830a7dffffc0f2c117e25b8cf3de5c85a5e614ceb8f

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 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: { bs_toggle: 'dropdown', bs_offset: "0,7" } %>
  <% else %>
    <%= content %>
  <% end %>

  <% if show_dropdown -%>
  <ul class="dropdown-menu dropdown-menu-end">
    <% 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

3 entries across 3 versions & 1 rubygems

Version Path
trestle-auth-0.5.0 app/views/trestle/auth/_userbox.html.erb
trestle-auth-0.5.0.pre2 app/views/trestle/auth/_userbox.html.erb
trestle-auth-0.5.0.pre app/views/trestle/auth/_userbox.html.erb