Add Wagtail CMS for kfet app.

K-Fêt
- Integrate wagtail to serve "static" pages of old K-Fêt website
- Fixture "kfetcms/kfet_wagtail_17_05" contains a copy of old website
(as in May 2017).
- Media files can be got until end of June 17 at
http://partage.eleves.ens.fr//files/604e6dea2ceebc66b1936c6b3f911744/kfet_media.tar.gz

Login/logout
- Update package django_cas_ng to last version.
- Clean COFCASBackend.
- Change CAS version to 3 (version used on eleves.ens). This enables
the logout redirection (for CAS ofc).
- Add messages and clean existing ones on login/logout (for both
outsider and cas users).

Misc
- Update settings to bypass an incompability between debug-toolbar and
wagtailmenus packages.
- Better management of dev/test-specific urls (if debug-toolbar wasn't in
INSTALLED_APPS, media files were not served).
- UI improvements.
This commit is contained in:
Aurélien Delobelle 2017-05-30 20:44:30 +02:00
parent b13e992a30
commit 8c6d56b27c
67 changed files with 3038 additions and 618 deletions

View file

@ -0,0 +1,68 @@
{% extends "kfet/base.html" %}
{% load static %}
{% load wagtailuserbar %}
{% load wagtailcore_tags %}
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static "kfetcms/css/index.css" %}">
{% endblock %}
{% block title %}{{ page.seo_title }}{% endblock %}
{% block header-class %}text-center{% endblock %}
{% block header-title %}{{ page.title }}{% endblock %}
{% block content %}
<div class="row row-messages">
{% include "kfet/base_messages.html" %}
</div>
<div class="row column-row">
<div class="cms-column {% block col-size %}column-md-2{% endblock %}">
<div class="cms-content">
{% block block1-content %}
{% endblock %}
{% block block2-content %}
{{ page.content|richtext }}
{% endblock %}
{% block block3-content %}
{% endblock %}
</div>
</div>
</div>
{% wagtailuserbar %}
<script type="text/javascript">
$( function() {
// Titles and their following elements (until next title) are unbreakable.
// This workaround should not be necessary if we use StreamField instead of
// RichTextField in wagtail pages.
$('.cms-content h2, .cms-content h3').filter( function() {
return $(this).closest('.unbreakable').length == 0;
})
.each( function() {
let elt = $('<div>', {class: "unbreakable"});
$(this).before(elt);
let current = $(this);
while (current.length !== 0) {
let next = current.next(':not(h2, h3)');
current.appendTo(elt);
current = next;
}
});
});
</script>
{% endblock %}
{% block footer %}
{% include "kfet/base_footer.html" %}
{% endblock %}

View file

@ -0,0 +1,46 @@
{% extends "kfetcms/base.html" %}
{% load static %}
{% load kfet_tags %}
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "kfet/css/home.css" %}">
{% endblock %}
{% block col-size %}column-sm-2 column-md-3{% endblock %}
{% block block3-content %}
{% if pressions %}
<div class="unbreakable carte carte-inverted">
<h3 class="carte-title">Pressions du moment</h3>
<ul class="carte-list">
{% for article in pressions %}
<li class="carte-item">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% endif %}
{% regroup articles by category as categories %}
{% for category in categories %}
<div class="unbreakable carte">
<h3 class="carte-title">{{ category.grouper.name }}</h3>
<ul class="carte-list">
{% for article in category.list %}
<li class="carte-item">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% endfor %}
{% endblock %}

View file

@ -0,0 +1,67 @@
{% extends "kfetcms/base.html" %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% block block1-content %}
{% for group_block in page.team_groups.all %}
<h3>{{ group_block.title }}</h3>
<div>
{{ group_block.content|richtext }}
</div>
{% with members=group_block.group.members.all %}
{% with len=members|length %}
{% if len > 0 %}
<div class="team-group row">
{% if len == 2 %}
<div class="visible-sm col-sm-3"></div>
{% endif %}
{% for member in members %}
<div class="col-xs-6 {% if len == 1 %}col-sm-4 col-sm-offset-4{% elif len == 3 %}col-sm-4{% elif len == 2%}col-sm-3 col-md-6{% else %}col-sm-3 col-md-4 col-lg-3{% endif %} {% if group_block.show_only != None and forloop.counter0 >= group_block.show_only %}member-more{% endif %}">
<div class="team-member thumbnail text-center">
{% image member.photo max-200x500 %}
<div class="infos">
<b>{{ member.get_full_name }}</b>
<br>
{% if member.nick_name %}
<i>alias</i> {{ member.nick_name }}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% if group_block.show_only != None and len > group_block.show_only %}
<div class="col-xs-12 col-btn text-center">
<button class="btn btn-primary btn-lg more">
{% if group_block.show_only %}
Y'en a plus !
{% else %}
Les voir
{% endif %}
</button>
</div>
{% endif %}
</div>
{% endif %}
{% endwith %}
{% endwith %}
{% endfor %}
<script type="text/javascript">
$( function() {
$('.more').click( function() {
$(this).closest('.col-btn').hide();
$(this).closest('.team-group').children('.member-more').show();
});
});
</script>
{% endblock %}