From 09e63bf00cb0e39bc92f91082d3b5ab3ef37f0fe Mon Sep 17 00:00:00 2001 From: Evarin Date: Tue, 22 Aug 2017 00:58:18 +0200 Subject: [PATCH] Actus et listes de clubs plus jolies et fonctionnelles, calendriers (beta) --- gestioncof/cms/models.py | 39 ++++++++++- gestioncof/cms/static/cofcms/css/screen.css | 69 +++++++++++++++++-- gestioncof/cms/static/cofcms/js/script.js | 13 ++++ gestioncof/cms/static/cofcms/sass/screen.scss | 68 +++++++++++++++++- gestioncof/cms/templates/cofcms/base.html | 1 + .../templates/cofcms/cof_directory_page.html | 13 ++-- .../cms/templates/cofcms/cof_root_page.html | 15 ++-- .../cms/templates/cofcms/mini_calendar.html | 11 +++ gestioncof/cms/templatetags/cofcms_tags.py | 19 ++++- 9 files changed, 230 insertions(+), 18 deletions(-) create mode 100644 gestioncof/cms/static/cofcms/js/script.js create mode 100644 gestioncof/cms/templates/cofcms/mini_calendar.html diff --git a/gestioncof/cms/models.py b/gestioncof/cms/models.py index 69f56ae0..9b72568e 100644 --- a/gestioncof/cms/models.py +++ b/gestioncof/cms/models.py @@ -109,7 +109,44 @@ class COFActuEventPage(Page): subpage_types = [] 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: verbose_name = "Actu liée à un évènement" verbose_name_plural = "Actus liées à des évènements" diff --git a/gestioncof/cms/static/cofcms/css/screen.css b/gestioncof/cms/static/cofcms/css/screen.css index ed2eb06f..5d41db14 100644 --- a/gestioncof/cms/static/cofcms/css/screen.css +++ b/gestioncof/cms/static/cofcms/css/screen.css @@ -70,7 +70,7 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, /* line 12, ../sass/screen.scss */ *, *:after, *:before { - box-sizing: content-box; + box-sizing: border-box; } /* line 16, ../sass/screen.scss */ @@ -189,23 +189,82 @@ header nav ul li > *:hover { .container .content section article + h2 { 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 { text-align: center; vertical-align: center; border: 2px solid transparent; padding: 1px; } -/* line 135, ../sass/screen.scss */ +/* line 201, ../sass/screen.scss */ .calendar th { font-weight: bold; } -/* line 140, ../sass/screen.scss */ +/* line 206, ../sass/screen.scss */ .calendar td.out { opacity: 0.3; } -/* line 143, ../sass/screen.scss */ +/* line 209, ../sass/screen.scss */ .calendar td.today { border-bottom-color: #000; } diff --git a/gestioncof/cms/static/cofcms/js/script.js b/gestioncof/cms/static/cofcms/js/script.js new file mode 100644 index 00000000..c7693a6d --- /dev/null +++ b/gestioncof/cms/static/cofcms/js/script.js @@ -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 = $("", {href:"ma"+"il"+"to:"+sticker}).text(sticker); + $(this).before(boite) + .remove(); + }) +}); diff --git a/gestioncof/cms/static/cofcms/sass/screen.scss b/gestioncof/cms/static/cofcms/sass/screen.scss index 42373298..ab374da7 100644 --- a/gestioncof/cms/static/cofcms/sass/screen.scss +++ b/gestioncof/cms/static/cofcms/sass/screen.scss @@ -10,7 +10,7 @@ @import "_colors"; *, *:after, *:before { - box-sizing: content-box; + box-sizing: border-box; } body { @@ -120,6 +120,72 @@ header { article + h2 { 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 { + + } + } + } } } } diff --git a/gestioncof/cms/templates/cofcms/base.html b/gestioncof/cms/templates/cofcms/base.html index dbf0faa4..05119dbd 100644 --- a/gestioncof/cms/templates/cofcms/base.html +++ b/gestioncof/cms/templates/cofcms/base.html @@ -6,6 +6,7 @@ {% block title %}Association des élèves de l'ENS Ulm{% endblock %} + {% block extra_head %}{% endblock %} diff --git a/gestioncof/cms/templates/cofcms/cof_directory_page.html b/gestioncof/cms/templates/cofcms/cof_directory_page.html index 62d6eff9..0c0b84da 100644 --- a/gestioncof/cms/templates/cofcms/cof_directory_page.html +++ b/gestioncof/cms/templates/cofcms/cof_directory_page.html @@ -1,6 +1,11 @@ {% extends "cofcms/base_aside.html" %} -{% load wagtailimages_tags cofcms_tags %} +{% load wagtailimages_tags cofcms_tags static %} +{% block extra_head %} + {{ block.super }} + + +{% endblock %} {% block aside %}

Accès rapide