Skip to content

Commit

Permalink
Fix #1789 Add action to return back to the All resources page from a …
Browse files Browse the repository at this point in the history
…viewer (#1791) (#1799)
  • Loading branch information
allyoucanmap authored Jul 3, 2024
1 parent 78112fc commit 676241e
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 40 deletions.
26 changes: 25 additions & 1 deletion geonode_mapstore_client/client/js/plugins/ActionNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { connect, createPlugin } from '@mapstore/framework/utils/PluginsUtils';
import { createSelector } from 'reselect';
Expand Down Expand Up @@ -85,6 +85,30 @@ function ActionNavbarPlugin(
checkResourcePerms(menuItem, resourcePerms)
);

useEffect(() => {
// set the correct height of navbar
const mainHeader = document.querySelector('.gn-main-header');
const mainHeaderPlaceholder = document.querySelector('.gn-main-header-placeholder');
const topbar = document.querySelector('#gn-topbar');
function resize() {
if (mainHeaderPlaceholder && mainHeader) {
mainHeaderPlaceholder.style.height = mainHeader.clientHeight + 'px';
}
if (topbar && mainHeader) {
topbar.style.top = mainHeader.clientHeight + 'px';
}
}
// hide the navigation bar if a resource is being viewed
document.getElementById('gn-topbar')?.classList.add('hide-navigation');
document.getElementById('gn-brand-navbar-bottom')?.classList.add('hide-search-bar');
resize();
return () => {
document.getElementById('gn-topbar')?.classList.remove('hide-navigation');
document.getElementById('gn-brand-navbar-bottom')?.classList.remove('hide-search-bar');
resize();
};
}, []);

return (
<ActionNavbar
leftItems={leftItems}
Expand Down
26 changes: 0 additions & 26 deletions geonode_mapstore_client/client/js/routes/Viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,32 +113,6 @@ function ViewerRoute({
const Loader = loaderComponent;
const className = `page-${resourceType}-viewer`;

useEffect(() => {
// set the correct height of navbar
const mainHeader = document.querySelector('.gn-main-header');
const mainHeaderPlaceholder = document.querySelector('.gn-main-header-placeholder');
const topbar = document.querySelector('#gn-topbar');
function resize() {
if (mainHeaderPlaceholder && mainHeader) {
mainHeaderPlaceholder.style.height = mainHeader.clientHeight + 'px';
}
if (topbar && mainHeader) {
topbar.style.top = mainHeader.clientHeight + 'px';
}
}
// hide the navigation bar if a resource is being viewed
if (!loading) {
document.getElementById('gn-topbar')?.classList.add('hide-navigation');
document.getElementById('gn-brand-navbar-bottom')?.classList.add('hide-search-bar');
resize();
}
return () => {
document.getElementById('gn-topbar')?.classList.remove('hide-navigation');
document.getElementById('gn-brand-navbar-bottom')?.classList.remove('hide-search-bar');
resize();
};
}, [loading]);

return (
<>
{resource && <MetaTags
Expand Down
37 changes: 37 additions & 0 deletions geonode_mapstore_client/static/mapstore/configs/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@
"cfg": {
"containerPosition": "header",
"leftMenuItems": [
{
"type": "link",
"size": "md",
"href": "#/all",
"labelId": "gnviewer.allResources"
},
{
"type": "plugin",
"size": "md",
Expand Down Expand Up @@ -1457,6 +1463,12 @@
"cfg": {
"containerPosition": "header",
"leftMenuItems": [
{
"type": "link",
"size": "md",
"href": "#/all",
"labelId": "gnviewer.allResources"
},
{
"type": "plugin",
"size": "md",
Expand Down Expand Up @@ -2184,6 +2196,12 @@
"cfg": {
"containerPosition": "header",
"leftMenuItems": [
{
"type": "link",
"size": "md",
"href": "#/all",
"labelId": "gnviewer.allResources"
},
{
"type": "plugin",
"size": "md",
Expand Down Expand Up @@ -2506,6 +2524,12 @@
"cfg": {
"containerPosition": "header",
"leftMenuItems": [
{
"type": "link",
"size": "md",
"href": "#/all",
"labelId": "gnviewer.allResources"
},
{
"type": "plugin",
"size": "md",
Expand Down Expand Up @@ -2757,6 +2781,12 @@
"cfg": {
"containerPosition": "header",
"leftMenuItems": [
{
"type": "link",
"size": "md",
"href": "#/all",
"labelId": "gnviewer.allResources"
},
{
"type": "plugin",
"size": "md",
Expand Down Expand Up @@ -4056,6 +4086,13 @@
"cfg": {
"containerPosition": "header",
"leftMenuItems": [
{
"type": "link",
"size": "md",
"href": "#/all",
"labelId": "gnviewer.allResources",
"disableIf": "{!!state('resourceParams')?.mapPk}"
},
{
"type": "link",
"href": "{'#/map/' + state('resourceParams')?.mapPk}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@
"linkResource": "Die verknüpfte Ressource konnte nicht gespeichert werden"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@
"linkResource": "No se pudo guardar el recurso vinculado"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@
"linkResource": "Échec de l'enregistrement de la ressource liée"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@
"linkResource": "Impossibile salvare la risorsa collegata"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"linkResource": "Failed to save linked resource"
}
}
}
},
"allResources": "All resources"
}
}
}

0 comments on commit 676241e

Please # to comment.