Add description text and page header to publi views
This commit is contained in:
parent
3fbd7b5859
commit
5fccab444e
5 changed files with 56 additions and 4 deletions
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-09-23 16:54
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
import markdownx.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mainsite', '0006_auto_20170923_1847'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='siteconfiguration',
|
||||
name='specialPublisDescr',
|
||||
field=markdownx.models.MarkdownxField(default='', verbose_name='Texte de la page des publications spéciales (Markdown)'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -15,6 +15,8 @@ class SiteConfiguration(SingletonModel):
|
|||
email = CharField("Adresse de contact du BOcal",
|
||||
max_length=128,
|
||||
help_text="Attention au spam…")
|
||||
specialPublisDescr = MarkdownxField("Texte de la page des "
|
||||
"publications spéciales (Markdown)")
|
||||
|
||||
def __str__(self):
|
||||
return "Configuration du site"
|
||||
|
|
|
@ -112,3 +112,12 @@ body {
|
|||
.main .page-header {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,18 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<p class="intro_text">{{ intro_text | markdownify }}</p>
|
||||
<h2 class="page-title">
|
||||
{% if is_year_view %}
|
||||
Millésime {{ year_range }}
|
||||
{% else %}
|
||||
{{ list_title }}
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
||||
<div class="intro-text">{{ intro_text | markdownify }}</div>
|
||||
|
||||
{% for bocal in publications %}
|
||||
<ul class="publication-list">
|
||||
{% for bocal in publications %}
|
||||
<li class="publication-entry">
|
||||
<a href="{{ bocal.url }}" title="Lire le BOcal !">{{ bocal }}</a> :
|
||||
|
||||
|
@ -17,6 +25,6 @@
|
|||
<span class="publication-date">{{ bocal.date | date:"d/m/Y" }}</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.shortcuts import get_object_or_404
|
|||
from django.views.generic import TemplateView
|
||||
from django.http import Http404
|
||||
|
||||
from mainsite.models import Publication, PublicationYear
|
||||
from mainsite.models import Publication, PublicationYear, SiteConfiguration
|
||||
|
||||
|
||||
class HomeView(TemplateView):
|
||||
|
@ -59,6 +59,8 @@ class YearView(PublicationListView):
|
|||
def additional_context(self, year, nYear):
|
||||
return {
|
||||
'intro_text': self.pubYear.descr,
|
||||
'is_year_view': True,
|
||||
'year_range': self.pubYear.prettyName,
|
||||
}
|
||||
|
||||
def get_publications(self, year, nYear):
|
||||
|
@ -67,6 +69,15 @@ class YearView(PublicationListView):
|
|||
|
||||
class SpecialPublicationsView(PublicationListView):
|
||||
''' Display the list of special publications '''
|
||||
|
||||
def additional_context(self):
|
||||
siteConf = SiteConfiguration.get_solo()
|
||||
return {
|
||||
'intro_text': siteConf.specialPublisDescr,
|
||||
'is_year_view': False,
|
||||
'list_title': "Numéros spéciaux",
|
||||
}
|
||||
|
||||
def get_publications(self):
|
||||
publications = Publication.objects\
|
||||
.filter(is_special=True)\
|
||||
|
|
Loading…
Reference in a new issue