[Fixes #3600] [GNIP] APIs to decouple import and load of GeoNode Client Libraries #3602
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes some code cleanup, by centralizing some methods and remove code redundancies, but mostly propose a way to make GeoNode GIS client libraries pluggable.
This done through a
geonode.client
app which should be used not only to collect the GIS client templates provided by default with GeoNode, but also defines a set of templatetags which can be used to easily plugin any other different client into the layer details or map templates.How to use it. Instead of doing something like this:
through this new mechanism you can now do this
the tag is translated into a method of a
HookSet
that simply translates the call into a custom template inclusion by passing thecontext
to it.Plugging in you own Hookset is easy as
INSTALLED_APPS
GEONODE_CLIENT_HOOKSET
pointing to your own HooksetAnd that's it. By default, if no
GEONODE_CLIENT_HOOKSET
is defined, GeoNode will use the GeoExt based oneGEONODE_CLIENT_HOOKSET = "geonode.client.hooksets.GeoExtHookSet"
This is the default one, and it is quite straight. Just defines which templates to include
On your own client library, you can manipulate the context as you wish and pass back to your templates any new variable.