clacks/lib/clacks_web/templates/layout/app.html.eex

51 lines
1.8 KiB
Elixir

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><%= assigns[:page_title] || instance_name() %></title>
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
</head>
<body>
<header>
<section class="container">
<nav role="navigation">
<ul>
<li><a href="/"><%= instance_name() %></a></li>
<%= if @conn.assigns[:user] do %>
<li><a href="<%= Routes.frontend_path(@conn, :search) %>">Search</a></li>
<% end %>
</ul>
<ul>
<%= if @conn.assigns[:user] do %>
<li>
Logged in as <a href="<%= Routes.actor_path(@conn, :get, @user.username) %>"><%= @user.username %></a>.
</li>
<li>
<%= form_for @conn, Routes.login_path(@conn, :logout), [method: :post], fn f -> %>
<%= submit "Log Out", class: "btn-link" %>
<% end %>
</li>
<% else %>
<li>
<a href="<%= login_path(@conn) %>">Log In</a>
</li>
<% end %>
</ul>
</nav>
</section>
</header>
<main role="main" class="container">
<%= if get_flash(@conn, :info) do %>
<p class="flash-info" role="alert"><%= get_flash(@conn, :info) %></p>
<% end %>
<%= if get_flash(@conn, :error) do %>
<p class="flash-error" role="alert"><%= get_flash(@conn, :error) %></p>
<% end %>
<%= render @view_module, @view_template, assigns %>
</main>
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</body>
</html>