udemy-go-web-2/cmd/web/templates/base.layout.gohtml

114 lines
5.2 KiB
Plaintext
Raw Normal View History

2024-08-03 20:26:40 +00:00
{{ define "base" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Buy Widgets</title>
2024-08-03 20:26:40 +00:00
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
<title>
{{ block "title" . }}
{{ end }}
</title>
</head>
<body>
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="#">&nbsp;</a>
<button class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">Products</a>
<ul class="dropdown-menu">
<li>
2024-08-07 09:56:53 +00:00
<a class="dropdown-item" href="/widget/1">Buy one widget</a>
</li>
<li>
2024-08-11 20:08:55 +00:00
<a class="dropdown-item" href="/plans/bronze">Subscription</a>
</li>
</ul>
</li>
{{ if eq .IsAuthenticated 1 }}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">Admin</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="/admin/virtual-terminal">Virtual Terminal</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="/admin/all-sales">All Sales</a>
</li>
<li>
2024-08-21 19:49:08 +00:00
<a class="dropdown-item" href="/admin/all-subscriptions">All Subscriptions</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="/admin/all-users">All Users</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="/logout">Logout</a>
</li>
</ul>
</li>
{{ end }}
2024-08-19 19:17:51 +00:00
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
{{ if eq .IsAuthenticated 1 }}
<li id="logout-link" class="nav-item">
<a href="/logout" class="nav-link">Logout</a>
</li>
{{ else }}
<li id="login-link" class="nav-item">
2024-08-19 19:17:51 +00:00
<a href="/login" class="nav-link">Login</a>
</li>
{{ end }}
2024-08-19 19:17:51 +00:00
</ul>
2024-08-12 19:38:12 +00:00
</ul>
</div>
</div>
</nav>
2024-08-03 20:26:40 +00:00
<div class="container">
<div class="row">
<div class="col">{{ block "content" . }} {{ end }}</div>
</div>
</div>
2024-08-04 12:40:32 +00:00
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
2024-08-19 19:17:51 +00:00
<script src="/static/js/base.js"></script>
2024-08-04 12:40:32 +00:00
{{ block "js" . }}
{{ end }}
2024-08-03 20:26:40 +00:00
</body>
</html>
{{ end }}