diff --git a/aircox/models/page.py b/aircox/models/page.py index 73a2151..f59fbd8 100644 --- a/aircox/models/page.py +++ b/aircox/models/page.py @@ -120,6 +120,10 @@ class BasePage(Renderable, models.Model): class Meta: abstract = True + @property + def cover_url(self): + return self.cover_id and self.cover.url + def __str__(self): return "{}".format(self.title or self.pk) @@ -153,7 +157,7 @@ class BasePage(Renderable, models.Model): def display_title(self): if self.is_published: return self.title - return self.parent and self.parent.display_title or "" + return self.parent and self.parent.title or "" @cached_property def display_headline(self): diff --git a/aircox/templates/admin/index.html b/aircox/templates/admin/index.html index 9dd6fb8..ca8d0d3 100644 --- a/aircox/templates/admin/index.html +++ b/aircox/templates/admin/index.html @@ -12,9 +12,11 @@ {% translate "Today" %} {% if diffusions %} +
{% for obj in diffusions %} - {% page_widget "item" obj.episode diffusion=obj timetable=True admin=True tag_class="tiny" %} + {% page_widget "card" obj.episode diffusion=obj timetable=True admin=True tag_class="small" %} {% endfor %} +
{% else %}
{% trans "No diffusion is scheduled for today." %} @@ -28,8 +30,8 @@ {% translate "Latest comments" %} {% if comments %} - {% for object in comments %} - {% page_widget "preview" object with_title=True %} + {% for object in comments|slice:":5" %} + {% page_widget "item" object with_title=True %} {% endfor %}
{% translate "All comments" %} diff --git a/aircox/templates/aircox/widgets/comment.html b/aircox/templates/aircox/widgets/comment.html index 95e17b8..f28af67 100644 --- a/aircox/templates/aircox/widgets/comment.html +++ b/aircox/templates/aircox/widgets/comment.html @@ -5,11 +5,13 @@ {% block outer %} {% if with_title %} - {% with url=object.parent.get_absolute_url %} + {% with url=object.get_absolute_url %} + {{ block.super }} {{ block.super }} {% endwith %} {% else %} {{ block.super }} + {{ block.super }} {% endif %} {% endblock %} diff --git a/aircox/templates/aircox/widgets/page.html b/aircox/templates/aircox/widgets/page.html index e432af9..0725271 100644 --- a/aircox/templates/aircox/widgets/page.html +++ b/aircox/templates/aircox/widgets/page.html @@ -1,12 +1,18 @@ {% extends widget_template %} -{% load i18n %} +{% load i18n aircox %} {% block outer %} -{% with url|default:object.get_absolute_url as url %} -{% with cover|default:object.cover.url as cover %} -{{ block.super }} -{% endwith %} +{% with cover|default:object.cover_url as cover %} + {% if admin %} + {% with object|admin_url:"change" as url %} + {{ block.super }} + {% endwith %} + {% else %} + {% with url|default:object.get_absolute_url as url %} + {{ block.super }} + {% endwith %} + {% endif %} {% endwith %} {% endblock %}