Actus et listes de clubs plus jolies et fonctionnelles, calendriers (beta)
This commit is contained in:
parent
53658589f8
commit
09e63bf00c
|
@ -110,6 +110,43 @@ class COFActuEventPage(Page):
|
||||||
subpage_types = []
|
subpage_types = []
|
||||||
parent_page_types = ['COFActuIndexPage']
|
parent_page_types = ['COFActuIndexPage']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dates(self):
|
||||||
|
if self.date_end:
|
||||||
|
if self.date_end.date() == self.date_start.date():
|
||||||
|
if self.all_day:
|
||||||
|
return self.date_start.strftime("le %A %w %B %Y")
|
||||||
|
else:
|
||||||
|
return "le %s à %s" % \
|
||||||
|
(self.date_start.strftime("%A %w %B %Y de %Hh%M"),
|
||||||
|
self.date_end.strftime("%Hh%M"))
|
||||||
|
else:
|
||||||
|
tmpl = "%A %w %B %Y"
|
||||||
|
diff_i = len(tmpl)
|
||||||
|
if self.date_end.year != self.date_start.year:
|
||||||
|
diff_i = len(tmpl)
|
||||||
|
elif self.date_end.month != self.date_start.month:
|
||||||
|
diff_i = len(tmpl) - 3
|
||||||
|
elif self.date_end.day != self.date_start.day:
|
||||||
|
diff_i = len(tmpl) - 6
|
||||||
|
common = tmpl[diff_i:]
|
||||||
|
diff = tmpl[:diff_i]
|
||||||
|
if self.all_day:
|
||||||
|
return "du %s au %s %s" % (self.date_start.strftime(diff),
|
||||||
|
self.date_end.strftime(diff),
|
||||||
|
self.date_end.strftime(common))
|
||||||
|
else:
|
||||||
|
return "du %s %s %s au %s %s" % \
|
||||||
|
(self.date_start.strftime(diff),
|
||||||
|
self.date_start.strftime(common),
|
||||||
|
self.date_start.strftime("%Hh%M"),
|
||||||
|
self.date_end.strftime(diff),
|
||||||
|
self.date_end.strftime("%Hh%M"))
|
||||||
|
else:
|
||||||
|
if self.all_day:
|
||||||
|
return self.date_start.strftime("le %A %w %B %Y")
|
||||||
|
else:
|
||||||
|
return self.date_start.strftime("le %A %w %B %Y à %Hh%M")
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Actu liée à un évènement"
|
verbose_name = "Actu liée à un évènement"
|
||||||
verbose_name_plural = "Actus liées à des évènements"
|
verbose_name_plural = "Actus liées à des évènements"
|
||||||
|
|
|
@ -70,7 +70,7 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu,
|
||||||
|
|
||||||
/* line 12, ../sass/screen.scss */
|
/* line 12, ../sass/screen.scss */
|
||||||
*, *:after, *:before {
|
*, *:after, *:before {
|
||||||
box-sizing: content-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 16, ../sass/screen.scss */
|
/* line 16, ../sass/screen.scss */
|
||||||
|
@ -189,23 +189,82 @@ header nav ul li > *:hover {
|
||||||
.container .content section article + h2 {
|
.container .content section article + h2 {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
/* line 125, ../sass/screen.scss */
|
||||||
|
.container .content section.directory article.entry {
|
||||||
|
width: 80%;
|
||||||
|
max-width: 600px;
|
||||||
|
max-height: 100%;
|
||||||
|
position: relative;
|
||||||
|
padding-right: 120px;
|
||||||
|
}
|
||||||
|
/* line 132, ../sass/screen.scss */
|
||||||
|
.container .content section.directory article.entry .entry-image {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 150px;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: -4px 4px 1px rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
right: 100px;
|
||||||
|
transform: translateX(90%);
|
||||||
|
top: -15px;
|
||||||
|
}
|
||||||
|
/* line 144, ../sass/screen.scss */
|
||||||
|
.container .content section.directory article.entry .entry-image img {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
/* line 155, ../sass/screen.scss */
|
||||||
|
.container .content section.actuhome article.actu {
|
||||||
|
background: none;
|
||||||
|
box-shadow: none;
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
/* line 160, ../sass/screen.scss */
|
||||||
|
.container .content section.actuhome article.actu .actu-header {
|
||||||
|
position: relative;
|
||||||
|
box-shadow: -4px 5px 1px rgba(0, 0, 0, 0.3);
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
/* line 167, ../sass/screen.scss */
|
||||||
|
.container .content section.actuhome article.actu .actu-header img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
min-height: 100%;
|
||||||
|
min-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
width: auto;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
/* line 177, ../sass/screen.scss */
|
||||||
|
.container .content section.actuhome article.actu .actu-header h2 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding-top: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
/* line 128, ../sass/screen.scss */
|
/* line 194, ../sass/screen.scss */
|
||||||
.calendar td, .calendar th {
|
.calendar td, .calendar th {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: center;
|
vertical-align: center;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
/* line 135, ../sass/screen.scss */
|
/* line 201, ../sass/screen.scss */
|
||||||
.calendar th {
|
.calendar th {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
/* line 140, ../sass/screen.scss */
|
/* line 206, ../sass/screen.scss */
|
||||||
.calendar td.out {
|
.calendar td.out {
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
/* line 143, ../sass/screen.scss */
|
/* line 209, ../sass/screen.scss */
|
||||||
.calendar td.today {
|
.calendar td.today {
|
||||||
border-bottom-color: #000;
|
border-bottom-color: #000;
|
||||||
}
|
}
|
||||||
|
|
13
gestioncof/cms/static/cofcms/js/script.js
Normal file
13
gestioncof/cms/static/cofcms/js/script.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
$(function() {
|
||||||
|
$(".facteur").on("click", function(){
|
||||||
|
var $this = $(this);
|
||||||
|
var sticker = $this.attr('data-mref')
|
||||||
|
.replace('pont', '.')
|
||||||
|
.replace('arbre', '@')
|
||||||
|
.replace(/(.)-/g, '$1');
|
||||||
|
|
||||||
|
var boite = $("<a>", {href:"ma"+"il"+"to:"+sticker}).text(sticker);
|
||||||
|
$(this).before(boite)
|
||||||
|
.remove();
|
||||||
|
})
|
||||||
|
});
|
|
@ -10,7 +10,7 @@
|
||||||
@import "_colors";
|
@import "_colors";
|
||||||
|
|
||||||
*, *:after, *:before {
|
*, *:after, *:before {
|
||||||
box-sizing: content-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -120,6 +120,72 @@ header {
|
||||||
article + h2 {
|
article + h2 {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.directory {
|
||||||
|
article.entry {
|
||||||
|
width: 80%;
|
||||||
|
max-width: 600px;
|
||||||
|
max-height: 100%;
|
||||||
|
position: relative;
|
||||||
|
padding-right: 120px;
|
||||||
|
|
||||||
|
.entry-image {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 150px;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: -4px 4px 1px rgba(#000, 0.2);
|
||||||
|
padding: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
right: 100px;
|
||||||
|
transform: translateX(90%);
|
||||||
|
top: -15px;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.actuhome {
|
||||||
|
article.actu {
|
||||||
|
background: none;
|
||||||
|
box-shadow: none;
|
||||||
|
max-width: 400px;
|
||||||
|
|
||||||
|
.actu-header {
|
||||||
|
position: relative;
|
||||||
|
box-shadow: -4px 5px 1px rgba(#000, 0.3);
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
min-height: 100%;
|
||||||
|
min-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
width: auto;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding-top: 150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actu-misc {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>{% block title %}Association des élèves de l'ENS Ulm{% endblock %}</title>
|
<title>{% block title %}Association des élèves de l'ENS Ulm{% endblock %}</title>
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "cofcms/css/screen.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "cofcms/css/screen.css" %}"/>
|
||||||
|
{% block extra_head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
{% extends "cofcms/base_aside.html" %}
|
{% extends "cofcms/base_aside.html" %}
|
||||||
{% load wagtailimages_tags cofcms_tags %}
|
{% load wagtailimages_tags cofcms_tags static %}
|
||||||
|
|
||||||
|
{% block extra_head %}
|
||||||
|
{{ block.super }}
|
||||||
|
<script src="{% static "js/jquery.min.js" %}"></script>
|
||||||
|
<script src="{% static "cofcms/js/script.js" %}"></script>
|
||||||
|
{% endblock %}
|
||||||
{% block aside %}
|
{% block aside %}
|
||||||
<h2>Accès rapide</h2>
|
<h2>Accès rapide</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -19,10 +24,10 @@
|
||||||
<section class="directory">
|
<section class="directory">
|
||||||
{% for entry in page.entries %}
|
{% for entry in page.entries %}
|
||||||
<article class="entry" id="{{ entry.slug }}">
|
<article class="entry" id="{{ entry.slug }}">
|
||||||
<h2>{{ entry.title }}</h2>
|
|
||||||
{% if entry.image %}
|
{% if entry.image %}
|
||||||
{% image entry.image width-400 class="entry-img" %}
|
<div class="entry-image">{% image entry.image width-150 class="entry-img" %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<h2>{{ entry.title }}</h2>
|
||||||
<div class="desc">{{ entry.body|safe }}</div>
|
<div class="desc">{{ entry.body|safe }}</div>
|
||||||
{% if entry.links %}
|
{% if entry.links %}
|
||||||
<ul class="links">
|
<ul class="links">
|
||||||
|
@ -31,7 +36,7 @@
|
||||||
{% if block.block_type == "lien" %}
|
{% if block.block_type == "lien" %}
|
||||||
<a href="{{ block.value.url }}">{{ block.value.texte }}</a>
|
<a href="{{ block.value.url }}">{{ block.value.texte }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ block.value.texte }} : <button data-mref="{{ block.value.email|obfuscate_mail }}" class="mail-contact">Afficher l'adresse mail</a>
|
{{ block.value.texte }} : <button data-mref="{{ block.value.email|obfuscate_mail }}" class="facteur">Afficher l'adresse mail</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -13,14 +13,19 @@
|
||||||
|
|
||||||
<section class="actuhome">
|
<section class="actuhome">
|
||||||
{% for actu in page.actus %}
|
{% for actu in page.actus %}
|
||||||
{% if actu.is_event %}
|
<article class="actu">
|
||||||
<article class="actu">
|
<div class="actu-header">
|
||||||
<h2>{{ actu.title }}</h2>
|
|
||||||
{% if actu.image %}
|
{% if actu.image %}
|
||||||
{% image actu.image fill-400x200 class="actu-img" %}
|
{% image actu.image fill-400x200 class="actu-img" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</article>
|
<h2>{{ actu.title }}</h2>
|
||||||
{% endif %}
|
</div>
|
||||||
|
{% if actu.is_event %}
|
||||||
|
<div class="actu-misc">
|
||||||
|
<span class="actu-minical">{% mini_calendar actu %}</span>{{ actu.dates }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</article>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
11
gestioncof/cms/templates/cofcms/mini_calendar.html
Normal file
11
gestioncof/cms/templates/cofcms/mini_calendar.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<table class="calendar mini">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
{% for day in days %}
|
||||||
|
<td class="{{ day.hasevent|yesno:"hasevent ," }}{{ day.today|yesno:"today," }}">
|
||||||
|
{{ day.day }}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -11,7 +11,7 @@ register = template.Library()
|
||||||
|
|
||||||
@register.filter()
|
@register.filter()
|
||||||
def obfuscate_mail(value):
|
def obfuscate_mail(value):
|
||||||
val = value.replace('', '/').replace('@', 'arbse').replace('.', 'pnt')
|
val = value.replace('', '-').replace('@', 'arbre').replace('.', 'pont')[1:]
|
||||||
return val
|
return val
|
||||||
|
|
||||||
@register.inclusion_tag("cofcms/calendar.html")
|
@register.inclusion_tag("cofcms/calendar.html")
|
||||||
|
@ -20,7 +20,7 @@ def calendar():
|
||||||
month_start = date(now.year, now.month, 1)
|
month_start = date(now.year, now.month, 1)
|
||||||
next_month = month_start + timedelta(days=32)
|
next_month = month_start + timedelta(days=32)
|
||||||
next_month = date(next_month.year, next_month.month, 1)
|
next_month = date(next_month.year, next_month.month, 1)
|
||||||
month_prestart = month_start - timedelta(days=(month_start.weekday()+7)%7)
|
month_prestart = month_start - timedelta(days=month_start.weekday())
|
||||||
month_postend = next_month + timedelta(days=(next_month.weekday()+6)%7)
|
month_postend = next_month + timedelta(days=(next_month.weekday()+6)%7)
|
||||||
events = COFActuEventPage.objects.live()\
|
events = COFActuEventPage.objects.live()\
|
||||||
.filter(date_start__range=[month_prestart,
|
.filter(date_start__range=[month_prestart,
|
||||||
|
@ -51,3 +51,18 @@ def calendar():
|
||||||
curday += deltaday
|
curday += deltaday
|
||||||
weeks.append(week)
|
weeks.append(week)
|
||||||
return {"events": events, "weeks": weeks}
|
return {"events": events, "weeks": weeks}
|
||||||
|
|
||||||
|
@register.inclusion_tag("cofcms/mini_calendar.html")
|
||||||
|
def mini_calendar(event):
|
||||||
|
days = []
|
||||||
|
today = timezone.now().date()
|
||||||
|
date_start = event.date_start.date()
|
||||||
|
date_end = event.date_end.date() if event.date_end else date_start
|
||||||
|
week_start = date_start - timedelta(days=date_start.weekday())
|
||||||
|
curday = week_start
|
||||||
|
for i in range(7):
|
||||||
|
days.append({'day': curday.day,
|
||||||
|
'hasevent': curday >= date_start and curday <= date_end,
|
||||||
|
'today': curday == today})
|
||||||
|
curday += timedelta(days=1)
|
||||||
|
return {"days": days}
|
||||||
|
|
Loading…
Reference in a new issue