<!-- views/header.ejs -->

<section class="row">
	<div class="col-sm-12">
		<nav class="navbar navbar-expand-md bg-dark navbar-dark" role="navigation">
			<a class="navbar-brand" href="#">Web- ja mobiiliohjelmointi</a>
			<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
				<span class="navbar-toggler-icon"></span>
			</button>
			<div class="collapse navbar-collapse" id="collapsibleNavbar">
				<ul class="navbar-nav">
					<li class="nav-item">
						<a class="nav-link" href="/">Viestien virta</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="/apidescr">Api-kuvaukset</a>
					</li>    
					<li class="nav-item dropdown">
						<% if (loggedin) { %>
							<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
								<%= username %>
							</a>
							<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
								<a class="dropdown-item" href="/session/logout">Kirjaudu ulos</a>
								<a class="dropdown-item" href="#">Muokkaa käyttäjätietoa</a>
							</div>
						<% } else { %>
							<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
								Kirjaudu
							</a>
							<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
								<a class="dropdown-item" href="/session/new">Kirjaudu</a>
								<a class="dropdown-item" href="/user/register">Rekisteröidy</a>
							</div>
						<% } %>
					</li>
				</ul>
			</div>
		</nav>
	</div>
</section>