Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Make publish label green

Adam Janik74e0535a230c
diff --git a/saleor/core/templatetags/status.py b/saleor/core/templatetags/status.py
index f1fda5fd69..4e270aca9a 100644
--- a/saleor/core/templatetags/status.py
+++ b/saleor/core/templatetags/status.py
@@ -58,5 +58,8 @@ def render_page_availability(page):
is_published = (
page.is_visible and (
page.available_on is None or page.available_on <= today))
- return {
- 'is_published': is_published, 'page': page}
+ ctx = {'is_published': is_published, 'page': page}
+ if is_published:
+ label_cls = LABEL_SUCCESS
+ ctx.update({'label_cls': label_cls})
+ return ctx
diff --git a/saleor/dashboard/page/forms.py b/saleor/dashboard/page/forms.py
index 8567b0bc67..3f7b2e9005 100644
--- a/saleor/dashboard/page/forms.py
+++ b/saleor/dashboard/page/forms.py
@@ -1,4 +1,5 @@
from django import forms
+from django.utils.translation import pgettext_lazy
from ...page.models import Page
from ..product.forms import RichTextField
@@ -11,6 +12,9 @@ class PageForm(forms.ModelForm):
exclude = []
widgets = {
'slug': forms.TextInput(attrs={'placeholder': 'example-slug'})}
+ labels = {
+ 'is_visible': pgettext_lazy(
+ 'Visibility status indicator', 'Publish')}
content = RichTextField()
diff --git a/templates/dashboard/includes/_page_availability.html b/templates/dashboard/includes/_page_availability.html
index 0db01ab3cf..92180fb224 100644
--- a/templates/dashboard/includes/_page_availability.html
+++ b/templates/dashboard/includes/_page_availability.html
@@ -1,9 +1,13 @@
{% load i18n %}
{% if is_published %}
- <div class="label">
+ <div class="label label-{{ label_cls }}">
{% trans "Published" context "Page availability status" %}
</div>
+{% elif not page.is_visible %}
+ <div class="label">
+ {% trans "Hidden" context "Page availability status" %}
+ </div>
{% elif page.available_on %}
<div class="label">
{% blocktrans with date=page.available_on context "Page availability status" %}
diff --git a/templates/page/details.html b/templates/page/details.html
index e8c03ace9a..6dc039defe 100644
--- a/templates/page/details.html
+++ b/templates/page/details.html
@@ -2,6 +2,7 @@
{% load i18n %}
{% load materializecss %}
+{% block title %}{{ page.title }} - {{ block.super }}{% endblock %}
{% block breadcrumb %}
<ul class="breadcrumbs list-unstyled">