From 264a0a852fb1a1d70a705c5ef24d3d39f54ed83e Mon Sep 17 00:00:00 2001 From: Tom Hubrecht <tom.hubrecht@ens.fr> Date: Sat, 26 Jun 2021 22:52:23 +0200 Subject: [PATCH] On utilise |richtext pour les champs RichText, ce qui permet de bien faire les rendus --- gestioncof/cms/templates/cofcms/base.html | 22 +++++++++---------- .../templates/cofcms/cof_actu_index_page.html | 22 +++++++++---------- .../cms/templates/cofcms/cof_actu_page.html | 4 ++-- .../templates/cofcms/cof_directory_page.html | 6 ++--- gestioncof/cms/templates/cofcms/cof_page.html | 6 ++--- .../cms/templates/cofcms/cof_root_page.html | 4 ++-- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/gestioncof/cms/templates/cofcms/base.html b/gestioncof/cms/templates/cofcms/base.html index a3c78bcb..c420115f 100644 --- a/gestioncof/cms/templates/cofcms/base.html +++ b/gestioncof/cms/templates/cofcms/base.html @@ -16,7 +16,7 @@ <link rel="stylesheet" type="text/css" href="{% static "fonts/SourceSansPro/sourceSansPro.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "cofcms/css/screen.css" %}"/> {% block extra_head %}{% endblock %} - + <meta name="viewport" content="width=device-width, initial-scale=1.0; minimum-scale=1.0;"> </head> @@ -32,27 +32,27 @@ <section class="bottom-menu"> <nav> {% flat_menu "cof-nav-int" template="cofcms/base_nav.html" apply_active_classes=True %} - - {% get_current_language as curlang %} - <div class="lang-select"> + {% get_current_language as curlang %} + + <div class="lang-select"> {% if curlang == 'en' %} - {% language 'fr' %} - <a href="{% pageurl self %}" title="Français"><img src="{% static "cofcms/images/fr.png" %}"></a> - {% endlanguage %} + {% language 'fr' %} + <a href="{% pageurl self %}" title="Français"><img src="{% static "cofcms/images/fr.png" %}"></a> + {% endlanguage %} {% else %} - {% language 'en' %} - <a href="{% pageurl self %}" title="English"><img src="{% static "cofcms/images/en.png" %}"></a> + {% language 'en' %} + <a href="{% pageurl self %}" title="English"><img src="{% static "cofcms/images/en.png" %}"></a> {% endlanguage %} {% endif %} - </div> + </div> </nav> </section> </header> <div class="container"> {% block superaside %}{% endblock %} - + <div class="content"> {% block content %}{% endblock %} </div> diff --git a/gestioncof/cms/templates/cofcms/cof_actu_index_page.html b/gestioncof/cms/templates/cofcms/cof_actu_index_page.html index 9ddd4550..4508a66c 100644 --- a/gestioncof/cms/templates/cofcms/cof_actu_index_page.html +++ b/gestioncof/cms/templates/cofcms/cof_actu_index_page.html @@ -17,17 +17,17 @@ {% block content %} <section class="intro"> <h1>{{ page.title }}</h1> - <div>{{ page.introduction|safe }}</div> + <div>{{ page.introduction|richtext }}</div> </section> <section class="actulist"> {% if actus.has_previous %} - <a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a> - {% endif %} + <a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a> + {% endif %} {% if actus.has_next %} - <a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a> - {% endif %} - + <a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a> + {% endif %} + {% for actu in page.actus %} <article class="actu"> <div class="actu-image" {% if actu.image %}{% image actu.image fill-400x200 as img %}style="background-image:url('{{ img.url }}');"{% endif %}></div> @@ -36,7 +36,7 @@ {% if actu.is_event %} <p><span class="actu-dates">{{ actu|dates|capfirst }}</span><br />{{ actu.chapo }}</p> {% else %} - {{ actu.body|safe|truncatewords_html:15 }} + {{ actu.body|richtext|truncatewords_html:15 }} {% endif %} <a href="{% pageurl actu %}">{% trans "Lire plus" %} ></a> </div> @@ -44,10 +44,10 @@ {% endfor %} {% if actus.has_previous %} - <a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a> - {% endif %} + <a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a> + {% endif %} {% if actus.has_next %} - <a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a> - {% endif %} + <a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a> + {% endif %} </section> {% endblock %} diff --git a/gestioncof/cms/templates/cofcms/cof_actu_page.html b/gestioncof/cms/templates/cofcms/cof_actu_page.html index 09e42e91..5cd88134 100644 --- a/gestioncof/cms/templates/cofcms/cof_actu_page.html +++ b/gestioncof/cms/templates/cofcms/cof_actu_page.html @@ -1,5 +1,5 @@ {% extends "cofcms/base.html" %} -{% load wagtailimages_tags cofcms_tags i18n %} +{% load wagtailcore_tags wagtailimages_tags cofcms_tags i18n %} {% block content %} <section class="intro"> @@ -11,7 +11,7 @@ <section class="pagecontent"> <div class="image">{% image page.image width-700 %}</div> <article> - {{ page.body|safe }} + {{ page.body|richtext }} </article> </section> {% endblock %} diff --git a/gestioncof/cms/templates/cofcms/cof_directory_page.html b/gestioncof/cms/templates/cofcms/cof_directory_page.html index 28f3c4c8..da0fa3ce 100644 --- a/gestioncof/cms/templates/cofcms/cof_directory_page.html +++ b/gestioncof/cms/templates/cofcms/cof_directory_page.html @@ -1,5 +1,5 @@ {% extends "cofcms/base_aside.html" %} -{% load wagtailimages_tags cofcms_tags static i18n %} +{% load wagtailcore_tags wagtailimages_tags cofcms_tags static i18n %} {% block extra_head %} {{ block.super }} @@ -18,7 +18,7 @@ {% block content %} <section class="intro"> <h1>{{ page.title }}</h1> - <div>{{ page.introduction|safe }}</div> + <div>{{ page.introduction|richtext }}</div> </section> <section class="directory"> @@ -28,7 +28,7 @@ <div class="entry-image">{% image entry.image width-150 class="entry-img" %}</div> {% endif %} <h2>{{ entry.title }}</h2> - <div class="desc">{{ entry.body|safe }}</div> + <div class="desc">{{ entry.body|richtext }}</div> {% if entry.links %} <ul class="links"> {% for block in entry.links %} diff --git a/gestioncof/cms/templates/cofcms/cof_page.html b/gestioncof/cms/templates/cofcms/cof_page.html index 28862d2b..278b39e5 100644 --- a/gestioncof/cms/templates/cofcms/cof_page.html +++ b/gestioncof/cms/templates/cofcms/cof_page.html @@ -1,10 +1,10 @@ {% extends "cofcms/base.html" %} -{% load wagtailimages_tags cofcms_tags %} +{% load wagtailcore_tags wagtailimages_tags cofcms_tags %} {% block content %} <section class="intro"> <h1>{{ page.title }}</h1> - <div>{{ page.introduction|safe }}</div> + <div>{{ page.introduction|richtext }}</div> </section> <section class="pagecontent"> @@ -13,7 +13,7 @@ <h2>{{ block.value }}</h2> {% elif block.block_type == "paragraph" %} <article class="paragraph"> - {{ block.value|safe }} + {{ block.value|richtext }} </article> {% elif block.block_type == "image" %} <div class="image"> diff --git a/gestioncof/cms/templates/cofcms/cof_root_page.html b/gestioncof/cms/templates/cofcms/cof_root_page.html index 7a91097e..27a39494 100644 --- a/gestioncof/cms/templates/cofcms/cof_root_page.html +++ b/gestioncof/cms/templates/cofcms/cof_root_page.html @@ -18,7 +18,7 @@ {% block content %} <section class="intro"> <h1>{{ page.title }}</h1> - <div>{{ page.introduction|safe }}</div> + <div>{{ page.introduction|richtext }}</div> </section> <section class="actuhome"> @@ -31,7 +31,7 @@ {% if actu.is_event %} <span class="actu-minical">{% mini_calendar actu %}</span><span class="actu-dates">{{ actu|dates }}</span> {% else %} - {{ actu.body|safe|truncatewords_html:10 }} + {{ actu.body|richtext|truncatewords_html:10 }} {% endif %} </div> <a href="{% pageurl actu %}" class="actu-overlay"></a>