forked from rc/aircox
ThreadRoute.title as url; update scripts about old Diffusion.sounds -> Sound.Diffusion (still need tests); cleanup unused and old code
This commit is contained in:
@ -127,10 +127,14 @@ class ThreadRoute(Route):
|
||||
|
||||
@classmethod
|
||||
def get_title(cl, model, request, thread_model, pk, **kwargs):
|
||||
return _('%(name)s: %(model)s') % {
|
||||
'model': model._meta.verbose_name_plural,
|
||||
'name': cl.get_thread(model, thread_model, pk).title,
|
||||
}
|
||||
thread = cl.get_thread(model, thread_model, pk)
|
||||
return '<a href="{url}">{title}</a>'.format(
|
||||
url = thread.url(),
|
||||
title = _('%(name)s: %(model)s') % {
|
||||
'model': model._meta.verbose_name_plural,
|
||||
'name': thread.title,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class DateRoute(Route):
|
||||
|
@ -14,7 +14,7 @@
|
||||
<link rel="stylesheet" href="{% static website.styles %}" type="text/css">
|
||||
{% endif %}
|
||||
<script src="{% static "aircox/cms/scripts.js" %}"></script>
|
||||
<title>{% if title %}{{ title }} - {% endif %}{{ website.name }}</title>
|
||||
<title>{% if title %}{{ title|striptags }} - {% endif %}{{ website.name }}</title>
|
||||
</head>
|
||||
<body>
|
||||
{% block page_header %}
|
||||
@ -51,7 +51,7 @@
|
||||
{% endif %}
|
||||
{% block title %}
|
||||
{% if title %}
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>{{ title|safe }}</h1>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class PostListView(BaseView, ListView):
|
||||
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
if not context.get('title') and self.route:
|
||||
if self.route and not context.get('title'):
|
||||
context['title'] = self.route.get_title(
|
||||
self.model, self.request, **self.kwargs
|
||||
)
|
||||
|
Reference in New Issue
Block a user