dorfylegends/backend/templates/layout.html

114 lines
5.6 KiB
HTML
Raw Normal View History

2022-04-16 21:34:19 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
2022-05-09 18:20:31 +03:00
<base href="{{suburi}}/">
<link rel="icon" type="image/x-icon" href="./favicon.ico">
2022-04-16 21:34:19 +03:00
<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>{{block "title" .}}{{end}}</title>
2022-05-09 18:20:31 +03:00
<link href="./css/bootstrap.min.css" rel="stylesheet">
<link href="./css/bootstrap-dark.css" rel="stylesheet">
<link href="./css/bootstrap-icons.css" rel="stylesheet">
<link href="./css/all.min.css" rel="stylesheet">
<link href="./css/legends.css" rel="stylesheet">
<script src="./js/jquery-3.6.0.min.js"></script>
<script src="./js/popper.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/autocomplete.js"></script>
<link href="./leaflet/leaflet.css" rel="stylesheet">
<script src="./leaflet/leaflet.js"></script>
2022-04-16 21:34:19 +03:00
</head>
<body>
2022-04-27 22:44:39 +03:00
<nav class="navbar navbar-expand-lg navbar-light bg-light mb-4">
<div class="container">
2022-05-10 10:51:04 +03:00
<a class="navbar-brand" href="#" style="font-weight: 500;">Legends Browser</a>
2022-04-27 22:44:39 +03:00
<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">
2022-05-10 10:51:04 +03:00
{{ if world }}
2022-04-27 22:44:39 +03:00
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
2022-05-09 18:20:31 +03:00
<a class="nav-link" href="./">Civilizations</a>
2022-04-27 22:44:39 +03:00
</li>
<li class="nav-item">
2022-05-10 10:51:04 +03:00
<a class="nav-link{{if not world.MapReady}} disabled{{end}}" href="./worldmap">World Map</a>
2022-04-27 22:44:39 +03:00
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Objects
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
2022-05-09 18:20:31 +03:00
<li><a class="dropdown-item" href="./geography">Geography</a></li>
<li><a class="dropdown-item" href="./entities">Entities</a></li>
<li><a class="dropdown-item" href="./sites">Sites</a></li>
<li><a class="dropdown-item" href="./structures">Structures</a></li>
<li><a class="dropdown-item" href="./hfs">Historical Figures</a></li>
<li><a class="dropdown-item" href="./identities">Identities</a></li>
<li><a class="dropdown-item" href="./worldconstructions">World Constructions</a></li>
<li><a class="dropdown-item" href="./artifacts">Artifacts</a></li>
<li><a class="dropdown-item" href="./artforms">Art Forms</a></li>
<li><a class="dropdown-item" href="./writtencontents">Written Contents</a></li>
2022-04-27 22:44:39 +03:00
</ul>
</li>
<li class="nav-item">
2022-05-09 18:20:31 +03:00
<a class="nav-link" href="./years">Years</a>
2022-04-27 22:44:39 +03:00
</li>
<li class="nav-item">
2022-05-09 18:20:31 +03:00
<a class="nav-link" href="./collections">Collections</a>
2022-04-27 22:44:39 +03:00
</li>
</ul>
2022-05-09 18:20:31 +03:00
<form class="d-flex" action="./search" method="get">
2022-04-29 21:23:00 +03:00
<div class="input-group">
2022-04-30 12:07:55 +03:00
<input id="search" class="form-control" name="search" type="search" placeholder="Search" aria-label="Search"
autocomplete="off">
2022-04-29 21:23:00 +03:00
<button class="btn btn-outline-secondary" type="submit"><i class="fa-solid fa-magnifying-glass"></i></button>
</div>
2022-04-27 22:44:39 +03:00
</form>
2022-04-29 21:23:00 +03:00
<script>
const ac = new Autocomplete(document.getElementById("search"), {
data: [{ label: "I'm a label", value: 42 }],
maximumItems: 50,
2022-05-09 18:20:31 +03:00
onInput: value => $.get("./search?term=" + value, data => ac.setData(data)),
onSelectItem: ({ label, value }) => window.location = "." + value
2022-04-29 21:23:00 +03:00
});
</script>
2022-05-10 10:51:04 +03:00
{{ end }}
2022-04-27 22:44:39 +03:00
</div>
</div>
</nav>
<div class="container">{{block "content" .}}{{end}}</div>
2022-04-28 21:14:33 +03:00
<script>
var hash = document.location.hash;
if (hash && hash.startsWith("#nav-")) {
var hashPieces = hash.split('?');
activeTab = $('.nav-link[data-bs-target="' + hashPieces[0] + '"]');
console.log(hashPieces[0], activeTab);
activeTab && activeTab.click()
}
$('.nav-tabs button').on('click', function (e) {
window.location.hash = $(this).data("bs-target")
});
2022-04-30 15:27:42 +03:00
function loadLinkPopoverData() {
return $.ajax({
2022-05-09 18:20:31 +03:00
url: "./popover" + this.getAttribute("href").substring(1),
2022-04-30 15:27:42 +03:00
async: false
}).responseText;
}
2022-05-07 22:17:05 +03:00
$('a.entity,a.hf,a.region,a.site,a.structure,a.worldconstruction,a.artifact,a.writtencontent,a.collection,a.landmass,a.mountain,a.identity,a.river').each(function () {
2022-04-30 15:27:42 +03:00
var popover = new bootstrap.Popover($(this), { content: loadLinkPopoverData, trigger: "hover", placement: "top", html: true })
})
2022-04-28 21:14:33 +03:00
</script>
2022-04-16 21:34:19 +03:00
</body>
</html>