Add links for Publisher and Servers to navbar if user is signed in.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<header>
|
||||
<.partial_navbar page_title={assigns[:page_title]} />
|
||||
<.partial_navbar
|
||||
page_title={assigns[:page_title]}
|
||||
current_user={assigns[:current_user]}
|
||||
/>
|
||||
</header>
|
||||
|
||||
<main class="px-4 pt-20 pb-2 sm:px-6 lg:px-8">
|
||||
|
||||
@@ -3,7 +3,8 @@ defmodule DecentralisedBookIndexWeb.Components.MyPartials.Navbar do
|
||||
use DecentralisedBookIndexWeb, :verified_routes
|
||||
alias Phoenix.LiveView.JS
|
||||
|
||||
attr(:page_title, :string, required: true)
|
||||
attr :page_title, :string, required: true
|
||||
attr :current_user, :map, default: nil
|
||||
|
||||
def partial_navbar(assigns) do
|
||||
~H"""
|
||||
@@ -32,6 +33,14 @@ defmodule DecentralisedBookIndexWeb.Components.MyPartials.Navbar do
|
||||
<li>
|
||||
<a href={~p"/authors/"} class={selected_navbar_link_css(@page_title, "Listing Authors")} aria-current="page">Authors</a>
|
||||
</li>
|
||||
<%= if @current_user != nil do %>
|
||||
<li>
|
||||
<a href={~p"/publishers/"} class={selected_navbar_link_css(@page_title, "Listing Publishers")} aria-current="page">Publishers</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={~p"/servers/"} class={selected_navbar_link_css(@page_title, "Listing Server")} aria-current="page">Servers</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user