refining login nav

This commit is contained in:
Adam Piontek 2021-03-09 11:06:32 -05:00
parent 4a367a6de6
commit 145115fb6f
2 changed files with 35 additions and 43 deletions

View file

@ -9,8 +9,8 @@ import "../node_modules/@mdi/svg/svg/skull-crossbones.svg"; // brand
// menus etc // menus etc
import "../node_modules/bootstrap-icons/icons/person-circle.svg"; // accounts menu import "../node_modules/bootstrap-icons/icons/person-circle.svg"; // accounts menu
import "../node_modules/bootstrap-icons/icons/person-plus.svg"; // new user / register import "../node_modules/bootstrap-icons/icons/person-plus.svg"; // new user / register
import "../node_modules/bootstrap-icons/icons/box-arrow-in-left.svg"; // log in import "../node_modules/bootstrap-icons/icons/door-open.svg"; // log in
import "../node_modules/bootstrap-icons/icons/box-arrow-right.svg"; // log out import "../node_modules/bootstrap-icons/icons/door-closed.svg"; // log out
import "../node_modules/bootstrap-icons/icons/sliders.svg"; // new user / register import "../node_modules/bootstrap-icons/icons/sliders.svg"; // new user / register
// forms etc // forms etc
import "../node_modules/bootstrap-icons/icons/at.svg"; // email field import "../node_modules/bootstrap-icons/icons/at.svg"; // email field
@ -31,7 +31,6 @@ import "../node_modules/bootstrap-icons/icons/trash.svg";
// page headers // page headers
import "../node_modules/bootstrap-icons/icons/shield-lock.svg"; // reset password import "../node_modules/bootstrap-icons/icons/shield-lock.svg"; // reset password
import "../node_modules/bootstrap-icons/icons/arrow-repeat.svg"; // resend confirmation import "../node_modules/bootstrap-icons/icons/arrow-repeat.svg"; // resend confirmation
import "../node_modules/bootstrap-icons/icons/door-open.svg"; // log in header
import "../node_modules/@mdi/svg/svg/head-question-outline.svg"; // forgot password import "../node_modules/@mdi/svg/svg/head-question-outline.svg"; // forgot password
import "../node_modules/bootstrap-icons/icons/people.svg"; // users management import "../node_modules/bootstrap-icons/icons/people.svg"; // users management

View file

@ -1,3 +1,12 @@
<%= if !@current_user do %>
<%= link nav_link_opts(@conn, to: Routes.user_session_path(@conn, :new), class: "btn btn-outline-light") do %>
<%= icon_div @conn, "bi-door-open", [class: "icon baseline", style: "margin-right:0.125rem;"] %>
Log in
<% end %>
<% else %>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarDropdownUserMenu" data-bs-toggle="dropdown" aria-expanded="false"> <a href="#" class="nav-link dropdown-toggle" id="navbarDropdownUserMenu" data-bs-toggle="dropdown" aria-expanded="false">
@ -7,48 +16,32 @@
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownUserMenu"> <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownUserMenu">
<%= if @current_user do %> <li><%= content_tag :span, @current_user.email, class: "dropdown-item-text" %></li>
<li><hr class="dropdown-divider"></li>
<li><%= content_tag :span, @current_user.email, class: "dropdown-item-text" %></li> <%= if Roles.can?(@current_user, %User{}, :index) do %>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_management_index_path(@conn, :index), class: "dropdown-item") do %>
<%= icon_div @conn, "bi-people", [class: "icon baseline me-1"] %>
Users
<% end %>
</li>
<li><hr class="dropdown-divider"></li> <li><hr class="dropdown-divider"></li>
<%= if Roles.can?(@current_user, %User{}, :index) do %>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_management_index_path(@conn, :index), class: "dropdown-item") do %>
<%= icon_div @conn, "bi-people", [class: "icon baseline me-1"] %>
Users
<% end %>
</li>
<li><hr class="dropdown-divider"></li>
<% end %>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_settings_path(@conn, :edit), class: "dropdown-item") do %>
<%= icon_div @conn, "bi-sliders", [class: "icon baseline me-1"] %>
Settings
<% end %>
</li>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_session_path(@conn, :delete), method: :delete, class: "dropdown-item") do %>
<%= icon_div @conn, "bi-box-arrow-right", [class: "icon baseline me-1"] %>
Log out
<% end %>
</li>
<% else %>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_registration_path(@conn, :new), class: "dropdown-item") do %>
<%= icon_div @conn, "bi-person-plus", [class: "icon baseline me-1"] %>
Register
<% end %>
</li>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_session_path(@conn, :new), class: "dropdown-item") do %>
<%= icon_div @conn, "bi-box-arrow-in-left", [class: "icon baseline me-1"] %>
Log in
<% end %>
</li>
<% end %> <% end %>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_settings_path(@conn, :edit), class: "dropdown-item") do %>
<%= icon_div @conn, "bi-sliders", [class: "icon baseline me-1"] %>
Settings
<% end %>
</li>
<li>
<%= link nav_link_opts(@conn, to: Routes.user_session_path(@conn, :delete), method: :delete, class: "dropdown-item") do %>
<%= icon_div @conn, "bi-door-closed", [class: "icon baseline me-1"] %>
Log out
<% end %>
</li>
</ul> </ul>
</li> </li>
<% end %>