Browse Source

feat: add user menu

main
Inhji Y. 7 months ago
parent
commit
67a45dcec8
  1. 1
      lib/mirage_web/templates/layout/_user_menu.html.eex
  2. 2
      lib/mirage_web/templates/setting/index.html.eex
  3. 6
      lib/mirage_web/templates/shared/user_menu.html.eex
  4. 11
      lib/mirage_web/templates/user/index.html.eex
  5. 3
      lib/mirage_web/views/shared_view.ex

1
lib/mirage_web/templates/layout/_user_menu.html.eex

@ -1,6 +1,5 @@
<%= if @current_user do %>
<li><%= link @current_user.email, to: Routes.user_path(@conn, :index) %></li>
<li><%= link "Settings", to: Routes.setting_path(@conn, :index) %></li>
<li><%= link "Log out", to: Routes.user_session_path(@conn, :delete), method: :delete %></li>
<% else %>
<%= if not Mirage.Accounts.has_user? do %>

2
lib/mirage_web/templates/setting/index.html.eex

@ -1,3 +1,5 @@
<%= render MirageWeb.SharedView, "user_menu.html", assigns %>
<div class="hero">
<h1>Listing Settings</h1>
</div>

6
lib/mirage_web/templates/shared/user_menu.html.eex

@ -0,0 +1,6 @@
<aside class="menu">
<ul>
<li><%= link "User", to: Routes.user_path(@conn, :index) %></li>
<li><%= link "Settings", to: Routes.setting_path(@conn, :index) %></li>
</ul>
</aside>

11
lib/mirage_web/templates/user/index.html.eex

@ -1,9 +1,4 @@
<aside class="menu">
<ul>
<li><%= link "User", to: Routes.user_path(@conn, :index) %></li>
<li><%= link "Settings", to: Routes.setting_path(@conn, :index) %></li>
</ul>
</aside>
<%= render MirageWeb.SharedView, "user_menu.html", assigns %>
<div class="hero">
<h1>User</h1>
@ -12,3 +7,7 @@
<section>
<p>hello world!</p>
</section>
<div class="buttons">
<%= link "Edit User", to: Routes.user_settings_path(@conn, :edit), class: "button" %>
</div>

3
lib/mirage_web/views/shared_view.ex

@ -0,0 +1,3 @@
defmodule MirageWeb.SharedView do
use MirageWeb, :view
end
Loading…
Cancel
Save