diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 2294c4b..aa6d6e7 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -811,6 +811,29 @@ class Event(models.Model): models.Index("start_time", "start_day", "end_day", "end_time", Lower("title"), name="datetimes title") ] + def chronology(self): + c = [] + if self.modified_date: + c.append({ "timestamp": self.modified_date, "data": "modified_date", "user": self.modified_by_user, "is_date": True }) + if self.moderated_date: + c.append({ "timestamp": self.moderated_date, "data": "moderated_date", "user" : self.moderated_by_user, "is_date": True}) + if self.imported_date: + c.append({ "timestamp": self.imported_date, "data": "imported_date", "user": self.imported_by_user, "is_date": True }) + if self.created_date: + c.append({ "timestamp": self.created_date + timedelta(milliseconds=-1), "data": "created_date", "user": self.created_by_user, "is_date": True}) + + c += [{ "timestamp": m.date, "data": m, "user": m.user, "is_date": False} for m in self.message_set.filter(spam=False)] + + if self.other_versions: + for o in self.other_versions.get_duplicated(): + if o != self: + c += [{ "timestamp": m.date, "data": m, "user": m.user, "is_date": False} for m in o.message_set.filter(spam=False)] + + + c.sort(key=lambda x: x["timestamp"]) + + return c + def sorted_tags(self): if self.tags is None: return [] diff --git a/src/agenda_culturel/static/style.scss b/src/agenda_culturel/static/style.scss index 824df90..f2e95af 100644 --- a/src/agenda_culturel/static/style.scss +++ b/src/agenda_culturel/static/style.scss @@ -1572,4 +1572,35 @@ label.required::after { .a-venir .line-now { margin-left: -2em; +} + +.chronology { + .entree { + display: grid; + grid-template-columns: fit-content(2em) auto; + column-gap: .7em; + .texte { + background: var(--background-color); + padding: 0.1em 0.8em; + border-radius: var(--border-radius); + p { + font-size: 100%; + } + p:last-child { + margin-bottom: 0.1em; + } + } + } + font-size: 85%; + footer { + margin-top: 1.8em; + padding: 0.2em .8em; + } + .ts { + @extend .badge-small; + border-radius: var(--border-radius); + display: inline-block; + width: 14em; + margin-right: 1.2em; + } } \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/event-date-info-inc.html b/src/agenda_culturel/templates/agenda_culturel/event-date-info-inc.html index 9a84b6a..4b6a21a 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event-date-info-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/event-date-info-inc.html @@ -1,13 +1,13 @@ {% if user.is_authenticated %} -