Fix: Hide empty 'view live' links

pull/5905/head
Karran Besen 2020-03-02 23:18:46 -03:00 zatwierdzone przez Andy Chosak
rodzic 3f86de27e0
commit 36e777418f
6 zmienionych plików z 25 dodań i 6 usunięć

Wyświetl plik

@ -35,6 +35,7 @@ Changelog
* Fix: Remove excess margin when editing snippets (Quadric)
* Fix: Added `scope` attribute to table headers in TableBlock output (Quadric)
* Fix: Prevent KeyError when accessing a StreamField on a deferred queryset (Paulo Alvarado)
* Fix: Hide empty 'view live' links (Karran Besen)
2.8 (03.02.2020)

Wyświetl plik

@ -441,6 +441,7 @@ Contributors
* pimarc
* minusf
* Paulo Alvarado
* Karran Besen
Translators
===========

Wyświetl plik

@ -53,6 +53,7 @@ Bug fixes
* Remove excess margin when editing snippets (Quadric)
* Added ``scope`` attribute to table headers in TableBlock output (Quadric)
* Prevent KeyError when accessing a StreamField on a deferred queryset (Paulo Alvarado)
* Hide empty 'view live' links (Karran Besen)
Upgrade considerations
@ -67,4 +68,4 @@ Django 2.1 is no longer supported as of this release; please upgrade to Django 2
``SiteMiddleware`` and ``request.site`` deprecated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wagtail's :class:`~wagtail.core.middleware.SiteMiddleware`, which makes the current site object available as the property ``request.site``, is now deprecated as it clashes with Django's sites framework and makes unnecessary database queries on non-Wagtail views. References to ``request.site`` in your code should be removed; the recommended way of retrieving the current site is ``Site.find_for_request(request)`` in Python code, and the ``{% wagtail_site %}`` tag within Django templates. Once these are removed, ``'wagtail.core.middleware.SiteMiddleware'`` can be removed from your project's ``MIDDLEWARE`` setting.
Wagtail's :class:`~wagtail.core.middleware.SiteMiddleware`, which makes the current site object available as the property ``request.site``, is now deprecated as it clashes with Django's sites framework and makes unnecessary database queries on non-Wagtail views. References to ``request.site`` in your code should be removed; the recommended way of retrieving the current site is ``Site.find_for_request(request)`` in Python code, and the ``{% wagtail_site %}`` tag within Django templates. Once these are removed, ``'wagtail.core.middleware.SiteMiddleware'`` can be removed from your project's ``MIDDLEWARE`` setting.

Wyświetl plik

@ -32,7 +32,11 @@
<li><a href="{% url 'wagtailadmin_pages:view_draft' page.id %}" class="button button-small button-secondary" target="_blank" rel="noopener noreferrer">{% trans 'Draft' %}</a></li>
{% endif %}
{% if page.live %}
<li><a href="{{ page.url }}" class="button button-small button-secondary" target="_blank" rel="noopener noreferrer">{% trans 'Live' %}</a></li>
{% with page_url=page.url %}
{% if page_url is not None %}
<li><a href="{{ page_url }}" class="button button-small button-secondary" target="_blank" rel="noopener noreferrer">{% trans 'Live' %}</a></li>
{% endif %}
{% endwith %}
{% endif %}
</ul>
</td>

Wyświetl plik

@ -30,7 +30,11 @@
<li><a href="{% url 'wagtailadmin_pages:view_draft' page.id %}" class="button button-small button-secondary" target="_blank" rel="noopener noreferrer">{% trans 'Draft' %}</a></li>
{% endif %}
{% if page.live %}
<li><a href="{{ page.url }}" class="button button-small button-secondary" target="_blank" rel="noopener noreferrer">{% trans 'Live' %}</a></li>
{% with page_url=page.url %}
{% if page_url is not None %}
<li><a href="{{ page_url }}" class="button button-small button-secondary" target="_blank" rel="noopener noreferrer">{% trans 'Live' %}</a></li>
{% endif %}
{% endwith %}
{% endif %}
</ul>
</td>

Wyświetl plik

@ -1,8 +1,16 @@
{% load i18n %}
{% if page.live %}
<a href="{{ page.url }}" target="_blank" rel="noopener noreferrer" class="status-tag primary" title="{% trans 'Visit the live page' %}">
<span class="visuallyhidden">{% trans "Current page status:" %}</span> {{ page.status_string }}
</a>
{% with page_url=page.url %}
{% if page_url is not None %}
<a href="{{ page_url }}" target="_blank" rel="noopener noreferrer" class="status-tag primary" title="{% trans 'Visit the live page' %}">
<span class="visuallyhidden">{% trans "Current page status:" %}</span> {{ page.status_string }}
</a>
{% else %}
<span class="status-tag primary">
<span class="visuallyhidden">{% trans "Current page status:" %}</span> {{ page.status_string }}
</span>
{% endif %}
{% endwith %}
{% else %}
<span class="status-tag">
<span class="visuallyhidden">{% trans "Current page status:" %}</span> {{ page.status_string }}