webu / dalec

Django Aggregator of a Lot of External Contents (DALEC) is a generic app to aggregate contents from various sources and display it in a generic way. Designed to be customized.
BSD 3-Clause "New" or "Revised" License
4 stars 6 forks source link

Template "list" : use more block to customize the html #25

Open weber-s opened 11 months ago

weber-s commented 11 months ago

The list (https://github.com/webu/dalec/blob/main/dalec/templates/dalec/default/list.html) is hardcoded to be into a "div". What if we want another tag (i.e. "section") or having item as "li" into a "ul" ?

Right now it is not possible without overiding the whole template. It would be nice to be able to customize the markup, without the needed JS part.

DylannCordel commented 11 months ago

You could override the template. But if you want to be sure to keep same "required code" (JS, some attrs...) you could do a PR to add three variables:

with those variables added, you could do this:

{% extends dalec/default/list.hml %}
{% block dalec_list_body %}
    {% with container_tag="section" %}
        {{ block.super }}
    {% endwith %}
{% endblock dalec_list_body %}

In your PR, you could also move the JS part inside a 3rd block named dalec_list_js