_navbar.html.erb 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <% if user_masquerade? %>
  2. <div class="alert alert-warning text-center">
  3. You're logged in as <b><%= current_user.name %> (<%= current_user.email %>)</b>
  4. <%= link_to back_masquerade_path(current_user) do %><%= icon("times") %> Logout <% end %>
  5. </div>
  6. <% end %>
  7. <nav class="navbar navbar-toggleable-md navbar-light bg-faded">
  8. <div class="container">
  9. <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  10. <span class="navbar-toggler-icon"></span>
  11. </button>
  12. <%= link_to "Spark", root_path, class: "navbar-brand" %>
  13. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  14. <ul class="navbar-nav mr-auto mt-2 mt-md-0">
  15. </ul>
  16. <ul class="navbar-nav">
  17. <li class="nav-item"><%= link_to "What's New", announcements_path, class: "nav-link #{unread_announcements(current_user)}" %></li>
  18. <% if user_signed_in? %>
  19. <li class="nav-item dropdown">
  20. <%= link_to root_path, id: "navbar-dropdown", class: "nav-link dropdown-toggle", data: { toggle: "dropdown" }, aria: { haspopup: true, expanded: false } do %>
  21. <%= image_tag gravatar_image_url(current_user.email, size: 40), height: 20, width: 20, class: "rounded" %>
  22. <% end %>
  23. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbar-dropdown">
  24. <% if current_user.admin? %>
  25. <%= link_to "Admin Area", admin_root_path, class: "dropdown-item" %>
  26. <% end %>
  27. <%= link_to "Settings", edit_user_registration_path, class: "dropdown-item" %>
  28. <div class="dropdown-divider"></div>
  29. <%= link_to "Logout", destroy_user_session_path, method: :delete, class: "dropdown-item" %>
  30. </div>
  31. </li>
  32. <% else %>
  33. <li class="nav-item"><%= link_to "Sign Up", new_user_registration_path, class: "nav-link" %></li>
  34. <li class="nav-item"><%= link_to "Login", new_user_session_path, class: "nav-link" %></li>
  35. <% end %>
  36. </ul>
  37. </div>
  38. </div>
  39. </nav>