django-reversion-compare icon indicating copy to clipboard operation
django-reversion-compare copied to clipboard

Object tools showing compare_links_partial.html are duplicated

Open florianm opened this issue 1 year ago • 0 comments

image Using django-grappelli (not sure that's related) I can see duplicated object tools from reversion_compare/templates/reversion-compare/compare_links_partial.html (the previous and next links) in both the header and the main content.

From all templates referencing compare_links_partial.html as per https://github.com/search?q=repo%3Ajedie%2Fdjango-reversion-compare%20reversion-compare%2Fcompare_links_partial.html&type=code I can only see compare.html used in the screenshot shown above. I'm puzzled where the second object tools are invoked here.

This is just a mild inconvenience I can fix by overriding the template of compare.py.

I can fix the duplication by moving the object-tools block in compare.html out of the content block:

{% block object-tools %}
   <ul class="object-tools">
     {% block object-tools-items %}
       {% include "reversion-compare/compare_links_partial.html"  %}
     {% endblock %}
   </ul>
{% endblock %}

{% block content %}
    <div id="content-main">

        <p class="help">
            {% blocktrans with date1=version1.revision.date_created|date:_("DATETIME_FORMAT") date2=version2.revision.date_created|date:_("DATETIME_FORMAT") %}
                Compare <strong>{{ date1 }}</strong> with <strong>{{ date2 }}</strong>:
            {% endblocktrans %}
        </p>

        {% include "reversion-compare/compare_partial.html" %}

        &lsaquo; <a href="{{ history_url }}">{% trans "Go back to history list" %}</a>
        &vert;
        <a href="{{ save_url }}">{% trans "Revert to this version" %}</a> &rsaquo;
    </div>
{% endblock %}

Now the admin looks like this: image Unrelated, I've removed the duplicated actions above compare_partial.

Does anyone else see this duplication of the content tools block?

florianm avatar Oct 25 '24 07:10 florianm