aceberg/ExerciseDiary

View on GitHub
internal/web/templates/header.html

Summary

Maintainability
Test Coverage
{{ define "header.html"}}

<!DOCTYPE html>
<html lang="en" data-bs-theme="{{ .Config.Color }}">
<head>
    <title>Exercise Diary</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--Favicon-->
    <link rel="icon" type="image/x-icon" href="/fs/public/favicon.png">
    {{ if eq .Config.NodePath "" }}
    <!-- Font for icons -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
    <!-- Bootstrap and theme -->
    <link href="https://cdn.jsdelivr.net/npm/aceberg-bootswatch-fork@v5.3.3-2/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
    <!-- JavaScript Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <!-- Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1"></script>
    <script src="https://cdn.jsdelivr.net/npm/chartjs-chart-matrix@2.0.1"></script>
    {{ else }} <!-- Local node_modules -->
    <link rel="stylesheet" href="{{ .Config.NodePath }}/node_modules/bootstrap-icons/font/bootstrap-icons.css">
    <link href="{{ .Config.NodePath }}/node_modules/bootswatch/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
    <script src="{{ .Config.NodePath }}/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="{{ .Config.NodePath }}/node_modules/chart.js/dist/chart.umd.js"></script>
    <script src="{{ .Config.NodePath }}/node_modules/chartjs-chart-matrix/dist/chartjs-chart-matrix.min.js"></script>
    {{ end }}
</head>
<body>
    <nav class="navbar navbar-expand-sm navbar-dark bg-primary">
        <div class="container-lg">
          <a class="navbar-brand" href="/">
            <img src="/fs/public/favicon.png" style="width: 2em"/>
          </a>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample03" aria-controls="navbarsExample03" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
    
          <div class="collapse navbar-collapse" id="navbarsExample03">
            <ul class="navbar-nav me-auto mb-2 mb-sm-0">
              <li class="nav-item">
                <a class="nav-link active" href="/exercise/?id=new">Add</a>
              </li>
              <li class="nav-item">
                <a class="nav-link active" href="/stats/">Stats</a>
              </li>
              <li class="nav-item">
                <a class="nav-link active" href="/weight/">Weight</a>
              </li>
              <li class="nav-item">
                <a class="nav-link active" href="/config/">Config</a>
              </li>
              {{ if .Config.Auth }}
              <li class="nav-item">
                <a class="nav-link active" href="/login/?logout=yes">LogOut</a>
              </li>
              {{ end }}
            </ul>
          </div>
        </div>
      </nav>
{{ end }}