Basic 404 handling

This commit is contained in:
Nicolò P 2023-04-12 15:53:39 +02:00
parent e7b5eb67d4
commit ae8f3ae4ad
2 changed files with 99 additions and 6 deletions

95
404.html Normal file
View File

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html>
<head>
<title>DataSpace | Not Found</title>
<link href="vendor/spectre.css/dist/spectre.css" rel="stylesheet" />
<link href="css/ds.css" rel="stylesheet" />
<link rel="shortcut icon" href="../img/favicon_dataspace.svg" />
</head>
<body>
<header class="navbar">
<section class="navbar-section">
<span class="pl-2">Not found</span>
</section>
<section class="navbar-section">
<a href="http://dataspace.ispc.cnr.it/auth" class="btn btn-link">Login</a>
<a href="http://dataspace.ispc.cnr.it" class="btn btn-link" title="Home">
<i class="fa fa-home"></i>
</a>
<a href="http://dataspace.ispc.cnr.it/search" class="btn btn-link" title="Search">
<i class="fa fa-search"></i>
</a>
<a class="btn btn-link" title="Print this page" id="print">
<i class="fa fa-print"></i>
</a>
<a class="btn btn-link"></a>
</section>
</header>
<main>
<div class="report-container">
<h1 class="text-center mt-2">
404<br>
Not Found
</h1>
<div class="columns mt-2" style="min-height: 40vh;">
<div class="column col-12">
<p class="text-large text-center p-2 m-2">
The requested resource wasn't found or it is not
implemented yet.
</p>
</div>
<div class="column col-12 text-center">
<img src="img/favicon_dataspace.svg" class="img-fit-contain">
</div>
</div>
</div>
</main>
<footer class="text-light">
<h6 class="text-bold mt-2">Institute of Heritage Science</h6>
<div class="columns mt-2">
<div class="column col-6">
<p class="mb-0">Find us</p>
<p class="text-small pt-2">
Via Cardinale Guglielmo Sanfelice 8, 80134 Napoli (NA), IT<br>
Tel: 081-247-0966
</p>
</div>
<div class="column col-3">
<p class="mb-0">Useful links</p>
<a class="text-small pt-2">About DataSpace</a>
<a class="text-small pt-2">Contact us</a>
</div>
<div class="column col-3">
<p class="mb-0">Disclaimer & Agreements</p>
<a class="text-small pt-2">Cookies Policy</a>
<a class="text-small pt-2">Privacy Policy</a>
</div>
</div>
<div class="columns mt-1 mb-2" style="border-top: 1px solid #fff">
<div class="column col-6 mt-1">
<p class="mt-1 mb-0 text-small">
<a href="https://www.cnr.it" title="CNR website">
National Research Council
</a> -
<a href="https://www.ispc.cnr.it" title="ISPC website">
Institute of Heritage Science
</a>
</p>
</div>
<div class="column col-3">
<div class="tile tile-centered text-small pt-2">
<div class="tile-icon">
<img height="30px" class="img-fit-contain" src="../img/favicon_dataspace.svg" />
</div>
<div class="tile-content">
2023 All rights reserved
</div>
</div>
</div>
<div class="column col-3 mt-1">
<a href="https://archesproject.org" class="text-small pt-2">Powered by Arches</a>
</div>
</div>
</footer>
</body>
</html>

View File

@ -75,15 +75,13 @@ DataSpace.renderReport = async function (report, archesJson, images)
{
let resource = report.resource;
let resKeys = Object.keys(resource);
// TODO prepare 404 page
if (!resKeys.length) {
let resType = resKeys[0].split(' ')[0];
if (!resKeys.length || ! (resType in this.RESOURCE_REPORT)) {
location.href = '/404.html';
return;
}
let resType = resKeys[0].split(' ')[0];
if (['Object', 'Context'].includes(resType)) {
const geoJSON = JSON.parse(
resource[`${resType} Coordinates`]
@ -350,7 +348,7 @@ DataSpace.attachReadMore = function (cssClass, maxWords = 100)
// TODO change this element, don't create a new one
more.onclick = function () {
const less = document.createElement('span');
less.textContent = 'Less';
less.textContent = 'Show less';
less.className = 'text-primary c-hand';
// Hacky...