Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending Geonode Template #6995

Closed
mattiagiupponi opened this issue Feb 25, 2021 · 3 comments
Closed

Extending Geonode Template #6995

mattiagiupponi opened this issue Feb 25, 2021 · 3 comments
Assignees
Labels
feature A new feature to be added to the codebase frontend Issues regarding Frontend and styling
Milestone

Comments

@mattiagiupponi
Copy link
Contributor

Is your feature request related to a problem? Please describe.
If you need to change a little part of geonode template (without touching the core) from an external app, sometimes is required to override the entire HTML instead of a small piece of the template due to the lack of {% block %} tags.
For example, if I want to add a new facet in _search_content.html, I need to extend the template and override the whole content instead of override only the part related to the facets.

Describe the solution you'd like
I'd like to start adding {% block %} tags in order to let geonode be more customizable from an external application.
Here is an example:
Actual code:

<div id="slide-pane">
{% if SEARCH_FILTERS.H_KEYWORDS_ENABLED %}
{% include "search/_h_keywords_filter.html" %}
{% endif %}
{% if SEARCH_FILTERS.T_KEYWORDS_ENABLED %}
{% include "search/_t_keywords_filter.html" %}
{% endif %}
{% if SEARCH_FILTERS.TYPE_ENABLED and include_type_filter == 'true' %}
{% include "search/_type_filters.html" %}
{% endif %}
{% include "search/_general_filters.html" %}
{% if SEARCH_FILTERS.REGION_ENABLED %}
{% include "search/_region_filter.html" %}
{% endif %}
{% if SEARCH_FILTERS.EXTENT_ENABLED %}
{% include "search/_extent_filter.html" %}
{% endif %}
</div>

Will become something like this:

{% block search_facet_lists %}
  {% if SEARCH_FILTERS.H_KEYWORDS_ENABLED %}
    {% include "search/_h_keywords_filter.html" %}
  {% endif %}
  {% if SEARCH_FILTERS.T_KEYWORDS_ENABLED %}
    {% include "search/_t_keywords_filter.html" %}
  {% endif %}
  {% if SEARCH_FILTERS.TYPE_ENABLED and include_type_filter == 'true' %}
    {% include "search/_type_filters.html" %}
  {% endif %}
  {% include "search/_general_filters.html" %}
  {% if SEARCH_FILTERS.REGION_ENABLED %}
    {% include "search/_region_filter.html" %}
  {% endif %}
  {% if SEARCH_FILTERS.EXTENT_ENABLED %}
    {% include "search/_extent_filter.html" %}
  {% endif %}
{% endblock %}

So from my application, i can do something like this:

{% extends "search/_search_content.html" %}
{% block search_facet_lists %}
    my custom facet lists
{% endblock %}

I think that will be really useful.
For sure will be a progressive process, I'll probably start from search.html, _search_content.html and panels.html

Describe alternatives you've considered
The alternatives, are don't add block tags and directly override the original template with the custom one, by changing the whole template HTML

Additional context
Django docs on {% block %} tags.

@mattiagiupponi mattiagiupponi self-assigned this Feb 25, 2021
@t-book
Copy link
Contributor

t-book commented Feb 25, 2021

👍

@t-book t-book added the feature A new feature to be added to the codebase label Feb 25, 2021
mattiagiupponi added a commit to geosolutions-it/geonode that referenced this issue Mar 1, 2021
@mattiagiupponi mattiagiupponi reopened this Mar 2, 2021
mattiagiupponi added a commit to geosolutions-it/geonode that referenced this issue Mar 2, 2021
@afabiani afabiani added this to the 3.2 milestone Mar 4, 2021
@afabiani afabiani added the frontend Issues regarding Frontend and styling label Mar 4, 2021
@afabiani afabiani reopened this Mar 4, 2021
afabiani pushed a commit that referenced this issue Mar 16, 2021
* [Fixes #6995] Extending Geonode Template

* [Fixes #6995] Extending Geonode Template

(cherry picked from commit 06cf7f8)
@etj
Copy link
Contributor

etj commented Apr 2, 2021

There's a need to exclude the free keywords from the editing page.
A new {block} should be added in order to allow extending pages to remove them.
While we're on it, we may want to add blocks for every non-mandatory field once and for all.

@etj etj reopened this Apr 2, 2021
mattiagiupponi added a commit to mattiagiupponi/geonode that referenced this issue Apr 7, 2021
mattiagiupponi added a commit to mattiagiupponi/geonode that referenced this issue Apr 7, 2021
afabiani pushed a commit that referenced this issue Apr 7, 2021
* [Resolves #6995] Increase UI block coverage in geonode

* [Resolves #6995] ADVANCED_EDIT_EXCLUDE_FIELD available also in maps and documents

Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it>
(cherry picked from commit 76f62f2)
afabiani pushed a commit that referenced this issue Apr 7, 2021
* [Resolves #6995] Increase UI block coverage in geonode

* [Resolves #6995] ADVANCED_EDIT_EXCLUDE_FIELD available also in maps and documents

Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it>
(cherry picked from commit 76f62f2)

Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
mattiagiupponi added a commit to mattiagiupponi/geonode that referenced this issue Apr 7, 2021
@etj
Copy link
Contributor

etj commented Apr 23, 2021

This issue has been used for extending the metadata editing page.
If the model has been customized, it's very likely that we may want to customize the metadata view as well.

By adding {block}s to metadata_detail.html would allow an easier customization of the page.

@etj etj reopened this Apr 23, 2021
mattiagiupponi added a commit to mattiagiupponi/geonode that referenced this issue Apr 27, 2021
afabiani pushed a commit that referenced this issue Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature to be added to the codebase frontend Issues regarding Frontend and styling
Projects
None yet
Development

No branches or pull requests

5 participants