Created
January 7, 2022 09:26
-
-
Save gannebamm/ef22d8c45c75b2537772ceb0f1e10851 to your computer and use it in GitHub Desktop.
Example of mapstore2 overrides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- _geonode_config.html file in geonode/templates/geonode-mapstore-client/_geonode_config.html --> | |
{% extends 'geonode-mapstore-client/_geonode_config.html' %} | |
{% block override_local_config %} | |
<script> | |
window.__GEONODE_CONFIG__.overrideLocalConfig = function(localConfig) { | |
// an example on how you can apply configuration to existing plugins | |
// example: DrawerMenu width (left panel) | |
var selectedPluginName = "TOC"; | |
var pluginPageName = "map_view"; | |
localConfig.plugins.map_edit.push({ "name": "SearchServicesConfig" }); | |
// localConfig.plugins.map_view.push({ "name": "FloatingLegend" }); | |
for (var i = 0; i < localConfig.plugins[pluginPageName].length; i++) { | |
var currentPlugin = localConfig.plugins[pluginPageName][i]; | |
var isSelectedPlugin = currentPlugin.name === selectedPluginName; | |
if (isSelectedPlugin) { | |
// apply configuration to the plugin | |
localConfig.plugins[pluginPageName][i] = { | |
"name": selectedPluginName, | |
"cfg": { | |
"activateAddLayerButton": true, | |
"activateMetedataTool": true, | |
"activateSettingsTool": true, | |
"activateRemoveLayer": true, | |
"showFullTitleOnExpand": true | |
} | |
} | |
} | |
} | |
var selectedPluginName = "TOCItemsSettings"; | |
for (var i = 0; i < localConfig.plugins[pluginPageName].length; i++) { | |
var currentPlugin = localConfig.plugins[pluginPageName][i]; | |
var isSelectedPlugin = currentPlugin.name === selectedPluginName; | |
if (isSelectedPlugin) { | |
// apply configuration to the plugin | |
localConfig.plugins[pluginPageName][i] = { | |
"name": selectedPluginName, | |
"cfg": { | |
"hideTitleTranslations": false, | |
"showFeatureInfoTab": true | |
} | |
} | |
} | |
} | |
var selectedPluginName = "DrawerMenu"; | |
for (var i = 0; i < localConfig.plugins[pluginPageName].length; i++) { | |
var currentPlugin = localConfig.plugins[pluginPageName][i]; | |
var isSelectedPlugin = currentPlugin.name === selectedPluginName; | |
if (isSelectedPlugin) { | |
// apply configuration to the plugin | |
localConfig.plugins[pluginPageName][i] = { | |
"name": selectedPluginName, | |
"cfg": { | |
"menuOptions": { | |
"docked": true | |
} | |
} | |
} | |
} | |
} | |
return localConfig; | |
}; | |
</script> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment