Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemilink authored Jun 19, 2022
2 parents c275f1b + 024236c commit fd32f52
Show file tree
Hide file tree
Showing 29 changed files with 877 additions and 59 deletions.
100 changes: 100 additions & 0 deletions templates/tutorialv2/events/descriptions.part.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{% load captureas %}

{% captureas performer_href %}{% url "member-detail" event.performer.username %}{% endcaptureas %}


{% if event.type == "authors_management" %}
{% captureas author_href %}{% url "member-detail" event.author.username %}{% endcaptureas %}
{% if event.action == "add" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a ajouté <a href="{{ author_href }}">{{ event.author }}</a> à la liste des auteurs.
{% elif event.action == "remove" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a supprimé <a href="{{ author_href }}">{{ event.author }}</a> de la liste des auteurs.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de type « {{ event.action }} » sur la liste des auteurs.
{% endif %}


{% elif event.type == "contributors_management" %}
{% captureas contributor_href %}{% url "member-detail" event.contributor.username %}{% endcaptureas %}
{% if event.action == "add" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a ajouté <a href="{{ contributor_href }}">{{ event.contributor }}</a> à la liste des contributeurs.
{% elif event.action == "remove" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a supprimé <a href="{{ contributor_href }}">{{ event.contributor }}</a> de la liste des contributeurs.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de type « {{ event.action }} » sur la liste des contributeurs.
{% endif %}


{% elif event.type == "beta_management" %}
{% captureas version_href %}{% url "content:view" event.content.pk event.content.slug %}?version={{ event.version }}{% endcaptureas %}
{% if event.action == "activate" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a mis une <a href="{{ version_href }}">version du contenu</a> en bêta.
{% elif event.action == "deactivate" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a désactivé la bêta.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de type « {{ event.action }} » sur la bêta.
{% endif %}


{% elif event.type == "validation_management" %}
{% captureas version_href %}{% url "content:view" event.content.pk event.content.slug %}?version={{ event.version }}{% endcaptureas %}
{% if event.action == "request" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a demandé la validation d'une <a href="{{ version_href }}">version du contenu</a>.
{% elif event.action == "cancel" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a annulé la demande de validation du contenu.
{% elif event.action == "accept" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a accepté le contenu pour publication.
{% elif event.action == "reject" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a refusé le contenu pour publication.
{% elif event.action == "revoke" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a dépublié le contenu.
{% elif event.action == "reserve" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a réservé le contenu pour validation.
{% elif event.action == "unreserve" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a annulé la réservation du contenu pour validation.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de validation de type « {{ event.action }} ».
{% endif %}


{% elif event.type == "tags_management" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a modifié les tags du contenu.


{% elif event.type == "suggestions_management" %}
{% if event.action == "add" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a ajouté une suggestion de contenu.
{% elif event.action == "remove" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a supprimé une suggestion de contenu.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de type « {{ event.action }} » sur les suggestions de contenu.
{% endif %}


{% elif event.type == "help_management" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a modifié les demandes d'aide.


{% elif event.type == "jsfiddle_management" %}
{% if event.action == "activate" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a activé JSFiddle.
{% elif event.action == "deactivate" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a désactivé JSFiddle.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de type « {{ event.action }} » sur la gestion de JS Fiddle.
{% endif %}


{% elif event.type == "opinions_management" %}
{% if event.action == "publish" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a publié le billet.
{% elif event.action == "unpublish" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a dépublié le billet.
{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a effectué une action de type « {{ event.action }} » sur le billet.
{% endif %}


{% else %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a déclenché un événement de type « {{ event.type }} ».
{% endif %}
74 changes: 74 additions & 0 deletions templates/tutorialv2/events/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{% extends "tutorialv2/base.html" %}
{% load profile %}
{% load thumbnail %}
{% load date %}
{% load i18n %}


{% block title %}
{% blocktrans with title=content.title %}
Journal des événements de "{{ title }}"
{% endblocktrans %}
{% endblock %}



{% block breadcrumb %}
<li><a href="{{ content.get_absolute_url }}">{{ content.title }}</a></li>
<li>{% trans "Journal des événements" %}</li>
{% endblock %}



{% block headline %}
{% if content.licence %}
<p class="license">
{{ content.licence }}
</p>
{% endif %}

<h1 {% if content.image %}class="illu"{% endif %}>
{% if content.image %}
<img src="{{ content.image.physical.tutorial_illu.url }}" alt="">
{% endif %}
{% blocktrans with title=content.title %}
Journal des événements de "{{ title }}"
{% endblocktrans %}
</h1>

{% if content.description %}
<h2 class="subtitle">
{{ content.description }}
</h2>
{% endif %}

{% include 'tutorialv2/includes/tags_authors.part.html' with content=content online=False %}
{% endblock %}



{% block content %}
{% if events %}
{% include "misc/paginator.html" with position="top" %}

<table class="fullwidth commits-list">
<thead>
<tr>
<th width="20%">{% trans "Date" %}</th>
<th>{% trans "Description" %}</th>
</tr>
</thead>
<tbody>
{% for e in events %}
<tr>
<td>{{ e.date | format_date:True }}</td>
<td>{% include 'tutorialv2/events/descriptions.part.html' with event=e %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "misc/paginator.html" with position="bottom" %}
{% else %}
<p>{% trans "Aucun événement n'a été enregistré pour ce contenu." %}</p>
{% endif %}
{% endblock %}
8 changes: 8 additions & 0 deletions templates/tutorialv2/view/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,14 @@ <h2>
</li>
{# END HISTORY #}

{# EVENTS #}
<li>
<a href="{% url "content:events" content.pk %}" class="ico-after history blue">
{% trans "Journal des événements" %}
</a>
</li>
{# END EVENTS #}

{# VALIDATION OR PUBLICATION (NO VALIDATION BEFORE) #}
{% if content.requires_validation %}
{# Validation (require validation before publication) #}
Expand Down
1 change: 1 addition & 0 deletions zds/notification/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = "zds.notification.apps.NotificationConfig"
8 changes: 8 additions & 0 deletions zds/notification/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.apps import AppConfig


class NotificationConfig(AppConfig):
name = "zds.notification"

def ready(self):
from . import receivers # noqa
5 changes: 0 additions & 5 deletions zds/notification/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,3 @@ class Meta:

def __str__(self):
return f'<Sujet "{self.topic.title}" suivi par {self.user.username}>'


# used to fix Django 1.9 Warning
# https://github.com/zestedesavoir/zds-site/issues/3451
from . import receivers # noqa
2 changes: 2 additions & 0 deletions zds/tutorialv2/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PublicationEvent,
ContentContributionRole,
)
from zds.tutorialv2.models.events import Event


class PublishableContentAdmin(admin.ModelAdmin):
Expand Down Expand Up @@ -118,3 +119,4 @@ class ContentReviewTypeAdmin(admin.ModelAdmin):
admin.site.register(ContentRead, ContentReadAdmin)
admin.site.register(PublicationEvent, PublicationEventAdmin)
admin.site.register(ContentContributionRole, ContentReviewTypeAdmin)
admin.site.register(Event)
58 changes: 58 additions & 0 deletions zds/tutorialv2/migrations/0032_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Generated by Django 2.2.24 on 2021-10-03 17:48

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("tutorialv2", "0031_source_is_url"),
]

operations = [
migrations.CreateModel(
name="Event",
fields=[
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("date", models.DateTimeField(auto_now_add=True)),
("type", models.CharField(max_length=100)),
("action", models.CharField(max_length=100)),
("version", models.CharField(max_length=80, null=True)),
(
"author",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="event_author",
to=settings.AUTH_USER_MODEL,
),
),
(
"content",
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="tutorialv2.PublishableContent"),
),
(
"contributor",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="event_contributor",
to=settings.AUTH_USER_MODEL,
),
),
(
"performer",
models.ForeignKey(
null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL
),
),
],
options={
"verbose_name": "Événement sur un contenu",
"verbose_name_plural": "Événements sur un contenu",
},
),
]
Loading

0 comments on commit fd32f52

Please sign in to comment.