forked from DGNum/gestioCOF
Improvements for K-Fêt CMS.
K-Fêt - Wagtail - Page content becomes a StreamField. - GroupTeam snippet becomes a block for stream field. - Navigation menu moved becomes a "flatmenu", preventing possible future conflicts. - Page layout can be modified in wagtail admin. K-Fêt - Add shorthands for ukf account balance/article price. - Cleaning stylesheets and templates.
This commit is contained in:
parent
6e82a2cf88
commit
1499c0bced
84 changed files with 2126 additions and 1894 deletions
|
@ -1,68 +1,41 @@
|
|||
{% extends "kfet/base.html" %}
|
||||
{% load static %}
|
||||
{% load wagtailuserbar %}
|
||||
{% load wagtailcore_tags %}
|
||||
{% extends page.layout %}
|
||||
{% load static wagtailcore_tags wagtailuserbar %}
|
||||
|
||||
{# CSS/JS #}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet" type="text/css" href="{% static "kfetcms/css/index.css" %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ page.seo_title }}{% endblock %}
|
||||
{# Titles #}
|
||||
|
||||
{% block header-class %}text-center{% endblock %}
|
||||
{% block title %}{{ page.seo_title }}{% endblock %}
|
||||
{% block header-title %}{{ page.title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{# Layout #}
|
||||
|
||||
<div class="row row-messages">
|
||||
{% include "kfet/base_messages.html" %}
|
||||
</div>
|
||||
{% block main-size %}{{ page.main_size|default:block.super }}{% endblock %}
|
||||
{% block mult-count %}{{ page.col_count|default:block.super }}{% endblock %}
|
||||
|
||||
<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 main-class %}cms main-bg{% endblock %}
|
||||
|
||||
{% block block2-content %}
|
||||
{{ page.content|richtext }}
|
||||
{% endblock %}
|
||||
{# Content #}
|
||||
|
||||
{% block block3-content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block main %}
|
||||
|
||||
{% for block in page.content %}
|
||||
<div class="{% if block.block_type == "rich" or block.block_type == "group" %}unbreakable{% endif %}">
|
||||
{% include_block block %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
{# Footer #}
|
||||
|
||||
{% block footer %}
|
||||
{% include "kfet/base_footer.html" %}
|
||||
{% endblock %}
|
||||
|
|
11
kfet/cms/templates/kfetcms/block_menu.html
Normal file
11
kfet/cms/templates/kfetcms/block_menu.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% load static %}
|
||||
|
||||
{% if pressions %}
|
||||
{% include "kfetcms/block_menu_category.html" with title="Pressions du moment" articles=pressions class="carte-inverted" %}
|
||||
{% endif %}
|
||||
|
||||
{% regroup articles by category as categories %}
|
||||
|
||||
{% for category in categories %}
|
||||
{% include "kfetcms/block_menu_category.html" with title=category.grouper.name articles=category.list %}
|
||||
{% endfor %}
|
12
kfet/cms/templates/kfetcms/block_menu_category.html
Normal file
12
kfet/cms/templates/kfetcms/block_menu_category.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<div class="carte {{ class }} unbreakable">
|
||||
<h3 class="carte-title">{{ title }}</h3>
|
||||
<ul class="carte-list">
|
||||
{% for article in articles %}
|
||||
<li class="carte-item">
|
||||
<div class="filler"></div>
|
||||
<span class="carte-label">{{ article.name }}</span>
|
||||
<span class="carte-ukf">{{ article.price_ukf }} UKF</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
|
@ -1,27 +1,32 @@
|
|||
{% extends "kfetcms/base.html" %}
|
||||
{% load wagtailcore_tags %}
|
||||
{% load wagtailimages_tags %}
|
||||
{% load wagtailcore_tags 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 groupteam=value len=value.members|length %}
|
||||
|
||||
{% 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 %}">
|
||||
{% for member in groupteam.members %}
|
||||
<div class="
|
||||
{% if len == 1 %}
|
||||
col-xs-12
|
||||
{% else %}
|
||||
col-xs-6
|
||||
{% if 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 %}
|
||||
{% endif %}
|
||||
{% if groupteam.show_only != None and forloop.counter0 >= groupteam.show_only %}
|
||||
member-more
|
||||
{% endif %}
|
||||
">
|
||||
<div class="team-member thumbnail text-center">
|
||||
{% image member.photo max-200x500 %}
|
||||
<div class="infos">
|
||||
|
@ -35,10 +40,10 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if group_block.show_only != None and len > group_block.show_only %}
|
||||
{% if groupteam.show_only != None and len > groupteam.show_only %}
|
||||
<div class="col-xs-12 col-btn text-center">
|
||||
<button class="btn btn-primary btn-lg more">
|
||||
{% if group_block.show_only %}
|
||||
{% if groupteam.show_only %}
|
||||
Y'en a plus !
|
||||
{% else %}
|
||||
Les voir
|
||||
|
@ -48,12 +53,8 @@
|
|||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<script type="text/javascript">
|
||||
$( function() {
|
||||
|
@ -63,5 +64,3 @@ $( function() {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,46 +0,0 @@
|
|||
{% 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 %}
|
Loading…
Add table
Add a link
Reference in a new issue