manager: mention on home page if a page is in menu (#51477)
This commit is contained in:
parent
0fd79d4c0a
commit
a53f37499a
|
@ -426,6 +426,14 @@ class Page(models.Model):
|
|||
def is_visible(self, user=None, ignore_superuser=False):
|
||||
return element_is_visible(self, user=user, ignore_superuser=ignore_superuser)
|
||||
|
||||
def extra_labels(self):
|
||||
extra_labels = []
|
||||
if not self.exclude_from_navigation:
|
||||
extra_labels.append(_('navigation'))
|
||||
if self.redirect_url:
|
||||
extra_labels.append(_('redirection'))
|
||||
return extra_labels
|
||||
|
||||
def get_cells(self):
|
||||
return CellBase.get_cells(page=self)
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ Use drag and drop with the ⣿ handles to reorder and change hierarchy of pages.
|
|||
<span class="group1">
|
||||
<a href="{% url 'combo-manager-page-view' pk=page.id %}">
|
||||
{{ page.title }}
|
||||
{% if page.redirect_url %} <small>({% trans "redirection" %})</small>{% endif %}
|
||||
{% for label in page.extra_labels %}{% if forloop.first %}<small>({% endif %}{{ label }}{% if forloop.last %})</small>{% else %}, {% endif %}{% endfor %}
|
||||
</a>
|
||||
</span>
|
||||
{% if not page.public %}
|
||||
|
|
|
@ -99,6 +99,25 @@ def test_pages_redirection(app, admin_user):
|
|||
assert '(redirection)' in resp
|
||||
|
||||
|
||||
def test_pages_in_menu(app, admin_user):
|
||||
page = Page.objects.create(title='One', slug='one')
|
||||
|
||||
app = login(app)
|
||||
resp = app.get('/manage/')
|
||||
assert '(navigation)' not in resp
|
||||
|
||||
page.exclude_from_navigation = False
|
||||
page.save()
|
||||
resp = app.get('/manage/')
|
||||
assert '(navigation)' in resp
|
||||
|
||||
# mix
|
||||
page.redirect_url = 'http://www.example.net'
|
||||
page.save()
|
||||
resp = app.get('/manage/')
|
||||
assert '(navigation, redirection)' in resp
|
||||
|
||||
|
||||
def test_add_page(app, admin_user):
|
||||
app = login(app)
|
||||
resp = app.get('/manage/', status=200)
|
||||
|
|
Loading…
Reference in New Issue