aceberg/WatchYourPorts

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>WatchYourPorts</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>
    {{ 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>
    {{ end }}
</head>
<body>
    <nav class="navbar navbar-expand-md navbar-dark bg-primary">
        <div class="container-lg">
            <a class="navbar-brand" href="/">
                <img src="/fs/public/favicon.png" style="width: 2em"/>
            </a>
          <ul class="navbar-nav">
              <li class="nav-item">
                  <button class="btn navbar-toggler nav-link active fs-2" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
                    <i class="bi bi-list"></i>
                  </button>
              </li>
          </ul>
          <div class="collapse navbar-collapse" id="navbarContent">
            <ul class="navbar-nav me-auto mb-2 mb-md-0">
                <li class="nav-item">
                  <a class="nav-link active" href="/">Home</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link active" href="/config/">Config</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link active" href="/history/">History</a>
                </li>
            </ul>
          </div>
          <ul class="navbar-nav">
              <li class="nav-item">
                  <a class="nav-link active fs-3 ms-md-2" target="_blank" href="https://github.com/aceberg/WatchYourPorts"><i class="bi bi-github"></i></a>
              </li>
          </ul>
        </div>
    </nav>
{{ end }}