Basic 404 handling
This commit is contained in:
10
js/ds.js
10
js/ds.js
@@ -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...
|
||||
|
||||
Reference in New Issue
Block a user