From 22a0af640e98a94945b2cef29cc19634988fc41c Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 25 Aug 2020 17:39:30 +0200 Subject: [PATCH] Cards for activity templates --- .../templates/activity/activity_detail.html | 29 ++- .../templates/activity/activity_entry.html | 244 ++++++++++-------- .../templates/activity/activity_form.html | 28 +- .../templates/activity/activity_invite.html | 15 -- .../templates/activity/activity_list.html | 69 ++--- .../{ => includes}/activity_info.html | 10 +- apps/activity/views.py | 2 +- 7 files changed, 209 insertions(+), 188 deletions(-) delete mode 100644 apps/activity/templates/activity/activity_invite.html rename apps/activity/templates/activity/{ => includes}/activity_info.html (95%) diff --git a/apps/activity/templates/activity/activity_detail.html b/apps/activity/templates/activity/activity_detail.html index 37dcb9a4..9cfc7640 100644 --- a/apps/activity/templates/activity/activity_detail.html +++ b/apps/activity/templates/activity/activity_detail.html @@ -1,22 +1,23 @@ {% extends "base.html" %} -{% load static %} -{% load i18n %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n perms %} {% load render_table from django_tables2 %} -{% load pretty_money %} -{% load perms %} {% block content %} +{% include "activity/includes/activity_info.html" %} - {% include "activity/activity_info.html" %} - - {% if guests.data %} -
-

{% trans "Guests list" %}

-
- {% render_table guests %} -
- {% endif %} - +{% if guests.data %} +
+

+ {% trans "Guests list" %} +

+
+ {% render_table guests %} +
+
+{% endif %} {% endblock %} {% block extrajavascript %} diff --git a/apps/activity/templates/activity/activity_entry.html b/apps/activity/templates/activity/activity_entry.html index cca044e2..806b486e 100644 --- a/apps/activity/templates/activity/activity_entry.html +++ b/apps/activity/templates/activity/activity_entry.html @@ -1,152 +1,168 @@ {% extends "base.html" %} -{% load static %} -{% load i18n %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load static i18n pretty_money perms %} {% load render_table from django_tables2 %} -{% load pretty_money %} -{% load perms %} {% block content %} -
-
-
- - {% trans "Transfer" %} - - {% if "note.notespecial"|not_empty_model_list %} - - {% trans "Credit" %} - - {% endif %} - {% for a in activities_open %} - - {% trans "Entries" %} {{ a.name }} - - {% endfor %} -
+
+
+
+ + {% trans "Transfer" %} + + {% if "note.notespecial"|not_empty_model_list %} + + {% trans "Credit" %} + + {% endif %} + {% for a in activities_open %} + + {% trans "Entries" %} {{ a.name }} + + {% endfor %}
+
- - - + + + - + -
+
-
-

{{ entries.count }} {% if entries.count >= 2 %}{% trans "entries" %}{% else %}{% trans "entry" %}{% endif %}

- {% render_table table %} -
+
+

{{ entries.count }} + {% if entries.count >= 2 %}{% trans "entries" %}{% else %}{% trans "entry" %}{% endif %}

+ {% render_table table %} +
{% endblock %} {% block extrajavascript %} - -{% endblock %} + $("#transaction_guest_" + id).click(makeTransaction); + $("#transaction_guest_" + id + "_especes").click(credit(1, "espèces")); + $("#transaction_guest_" + id + "_cb").click(credit(2, "carte bancaire")); + } + }); + } + +{% endblock %} \ No newline at end of file diff --git a/apps/activity/templates/activity/activity_form.html b/apps/activity/templates/activity/activity_form.html index 99c254e3..6bfd4f34 100644 --- a/apps/activity/templates/activity/activity_form.html +++ b/apps/activity/templates/activity/activity_form.html @@ -1,11 +1,21 @@ {% extends "base.html" %} -{% load static %} -{% load i18n %} -{% load crispy_forms_tags %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n crispy_forms_tags %} +{% block contenttitle %}{% endblock %} + {% block content %} -
-{% csrf_token %} -{{form|crispy}} - -
-{% endblock %} +
+

+ {{ title }} +

+
+
+ {% csrf_token %} + {{ form|crispy }} + +
+
+
+{% endblock %} \ No newline at end of file diff --git a/apps/activity/templates/activity/activity_invite.html b/apps/activity/templates/activity/activity_invite.html deleted file mode 100644 index 8bdb1965..00000000 --- a/apps/activity/templates/activity/activity_invite.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} -{% load render_table from django_tables2 %} -{% load i18n crispy_forms_tags %} -{% block content %} -
- {% csrf_token %} - {{ form|crispy }} - -
-{% endblock %} - -{% block extrajavascript %} - -{% endblock %} diff --git a/apps/activity/templates/activity/activity_list.html b/apps/activity/templates/activity/activity_list.html index 3c2add37..0a1eb4de 100644 --- a/apps/activity/templates/activity/activity_list.html +++ b/apps/activity/templates/activity/activity_list.html @@ -1,41 +1,50 @@ {% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load render_table from django_tables2 %} -{% load i18n crispy_forms_tags%} -{% block content %} - {% if started_activities %} -

{% trans "Current activity" %}

- {% for activity in started_activities %} - {% include "activity/activity_info.html" %} -
- {% endfor %} - {% endif %} +{% load i18n %} +{% block contenttitle %}{% endblock %} -

{% trans "Upcoming activities" %}

+{% block content %} +{% if started_activities %} +
+

+ {% trans "Current activity" %} +

+
+ {% for activity in started_activities %} + {% include "activity/includes/activity_info.html" %} + {% endfor %} +
+
+{% endif %} + +
+

+ {% trans "Upcoming activities" %} +

{% if upcoming.data %} - {% render_table upcoming %} + {% render_table upcoming %} {% else %} +
{% trans "There is no planned activity." %}
+
{% endif %} + +
- {% trans 'New activity' %} - -
- -

{% trans "All activities" %}

- +
+

+ {% trans "All activities" %} +

{% render_table table %} -{% endblock %} - -{% block extrajavascript %} - -{% endblock %} +
+{% endblock %} \ No newline at end of file diff --git a/apps/activity/templates/activity/activity_info.html b/apps/activity/templates/activity/includes/activity_info.html similarity index 95% rename from apps/activity/templates/activity/activity_info.html rename to apps/activity/templates/activity/includes/activity_info.html index ca2988b5..320bbb51 100644 --- a/apps/activity/templates/activity/activity_info.html +++ b/apps/activity/templates/activity/includes/activity_info.html @@ -1,10 +1,10 @@ -{% load i18n %} -{% load perms %} -{% load pretty_money %} - +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n perms pretty_money %} {% url 'activity:activity_detail' activity.pk as activity_detail_url %} -
+

{% if request.path_info != activity_detail_url %} diff --git a/apps/activity/views.py b/apps/activity/views.py index db318fdc..bd3d651b 100644 --- a/apps/activity/views.py +++ b/apps/activity/views.py @@ -117,7 +117,7 @@ class ActivityInviteView(ProtectQuerysetMixin, ProtectedCreateView): """ model = Guest form_class = GuestForm - template_name = "activity/activity_invite.html" + template_name = "activity/activity_form.html" def get_sample_object(self): """ Creates a standart Guest binds to the Activity"""