From 5ea531fe68bb72399341545eeb7e1e9db39e460e Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 27 Apr 2020 03:56:22 +0200 Subject: [PATCH] Filter buttons list with visible buttons only --- apps/note/models/transactions.py | 3 +- apps/note/tables.py | 3 +- locale/de/LC_MESSAGES/django.po | 45 +++++--- locale/fr/LC_MESSAGES/django.po | 45 +++++--- templates/note/transactiontemplate_form.html | 4 +- templates/note/transactiontemplate_list.html | 111 +++++++++++-------- 6 files changed, 125 insertions(+), 86 deletions(-) diff --git a/apps/note/models/transactions.py b/apps/note/models/transactions.py index 83f8f914..455ac841 100644 --- a/apps/note/models/transactions.py +++ b/apps/note/models/transactions.py @@ -214,8 +214,7 @@ class RecurrentTransaction(Transaction): template = models.ForeignKey( TransactionTemplate, - null=True, - on_delete=models.SET_NULL, + on_delete=models.PROTECT, ) category = models.ForeignKey( TemplateCategory, diff --git a/apps/note/tables.py b/apps/note/tables.py index 8504121c..a1385abc 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -129,13 +129,14 @@ class ButtonTable(tables.Table): 'table table-bordered condensed table-hover' } row_attrs = { - 'class': lambda record: 'table-row ' + 'table-success' if record.display else 'table-danger', + 'class': lambda record: 'table-row ' + ('table-success' if record.display else 'table-danger'), 'id': lambda record: "row-" + str(record.pk), 'data-href': lambda record: record.pk } model = TransactionTemplate exclude = ('id',) + order_by = ('type', '-display', 'destination__name', 'name',) edit = tables.LinkColumn('note:template_update', args=[A('pk')], diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 3daca779..111f60b6 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-27 03:19+0200\n" +"POT-Creation-Date: 2020-04-27 03:55+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -46,7 +46,7 @@ msgstr "" #: apps/activity/models.py:23 apps/activity/models.py:48 #: apps/member/models.py:99 apps/member/models.py:202 #: apps/note/models/notes.py:188 apps/note/models/transactions.py:24 -#: apps/note/models/transactions.py:44 apps/note/models/transactions.py:237 +#: apps/note/models/transactions.py:44 apps/note/models/transactions.py:236 #: templates/member/club_info.html:13 templates/member/profile_info.html:14 #: templates/registration/future_profile_detail.html:16 msgid "name" @@ -238,12 +238,12 @@ msgstr "" msgid "create" msgstr "" -#: apps/logs/models.py:61 apps/note/tables.py:144 +#: apps/logs/models.py:61 apps/note/tables.py:145 #: templates/activity/activity_detail.html:67 msgid "edit" msgstr "" -#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:149 +#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:150 msgid "delete" msgstr "" @@ -672,33 +672,33 @@ msgstr "" msgid "Transfer" msgstr "" -#: apps/note/models/transactions.py:227 +#: apps/note/models/transactions.py:226 msgid "Template" msgstr "" -#: apps/note/models/transactions.py:242 +#: apps/note/models/transactions.py:241 msgid "first_name" msgstr "" -#: apps/note/models/transactions.py:247 +#: apps/note/models/transactions.py:246 msgid "bank" msgstr "" -#: apps/note/models/transactions.py:253 +#: apps/note/models/transactions.py:252 #: templates/activity/activity_entry.html:17 #: templates/note/transaction_form.html:24 msgid "Credit" msgstr "" -#: apps/note/models/transactions.py:253 templates/note/transaction_form.html:28 +#: apps/note/models/transactions.py:252 templates/note/transaction_form.html:28 msgid "Debit" msgstr "" -#: apps/note/models/transactions.py:269 apps/note/models/transactions.py:274 +#: apps/note/models/transactions.py:268 apps/note/models/transactions.py:273 msgid "membership transaction" msgstr "" -#: apps/note/models/transactions.py:270 +#: apps/note/models/transactions.py:269 msgid "membership transactions" msgstr "" @@ -714,11 +714,11 @@ msgstr "" msgid "No reason specified" msgstr "" -#: apps/note/tables.py:122 apps/note/tables.py:151 +#: apps/note/tables.py:122 apps/note/tables.py:152 msgid "Delete" msgstr "" -#: apps/note/tables.py:146 templates/member/club_info.html:55 +#: apps/note/tables.py:147 templates/member/club_info.html:55 #: templates/note/conso_form.html:128 msgid "Edit" msgstr "" @@ -819,6 +819,7 @@ msgstr "" #: templates/activity/activity_invite.html:8 #: templates/django_filters/rest_framework/form.html:5 #: templates/member/add_members.html:14 templates/member/club_form.html:9 +#: templates/note/transactiontemplate_form.html:15 #: templates/treasury/invoice_form.html:46 msgid "Submit" msgstr "" @@ -1306,22 +1307,30 @@ msgid "Current price" msgstr "" #: templates/note/transactiontemplate_list.html:9 -msgid "search button" +msgid "Search button" msgstr "" -#: templates/note/transactiontemplate_list.html:13 +#: templates/note/transactiontemplate_list.html:11 +msgid "Name of the button..." +msgstr "" + +#: templates/note/transactiontemplate_list.html:16 +msgid "Display visible buttons only" +msgstr "" + +#: templates/note/transactiontemplate_list.html:21 msgid "New button" msgstr "" -#: templates/note/transactiontemplate_list.html:20 +#: templates/note/transactiontemplate_list.html:28 msgid "buttons listing " msgstr "" -#: templates/note/transactiontemplate_list.html:70 +#: templates/note/transactiontemplate_list.html:86 msgid "button successfully deleted " msgstr "" -#: templates/note/transactiontemplate_list.html:74 +#: templates/note/transactiontemplate_list.html:90 msgid "Unable to delete button " msgstr "" diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 51075884..ab608942 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-27 03:19+0200\n" +"POT-Creation-Date: 2020-04-27 03:55+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -42,7 +42,7 @@ msgstr "Vous ne pouvez pas inviter plus de 3 personnes à cette activité." #: apps/activity/models.py:23 apps/activity/models.py:48 #: apps/member/models.py:99 apps/member/models.py:202 #: apps/note/models/notes.py:188 apps/note/models/transactions.py:24 -#: apps/note/models/transactions.py:44 apps/note/models/transactions.py:237 +#: apps/note/models/transactions.py:44 apps/note/models/transactions.py:236 #: templates/member/club_info.html:13 templates/member/profile_info.html:14 #: templates/registration/future_profile_detail.html:16 msgid "name" @@ -234,12 +234,12 @@ msgstr "Nouvelles données" msgid "create" msgstr "Créer" -#: apps/logs/models.py:61 apps/note/tables.py:144 +#: apps/logs/models.py:61 apps/note/tables.py:145 #: templates/activity/activity_detail.html:67 msgid "edit" msgstr "Modifier" -#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:149 +#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:150 msgid "delete" msgstr "Supprimer" @@ -675,33 +675,33 @@ msgstr "transactions" msgid "Transfer" msgstr "Virement" -#: apps/note/models/transactions.py:227 +#: apps/note/models/transactions.py:226 msgid "Template" msgstr "Bouton" -#: apps/note/models/transactions.py:242 +#: apps/note/models/transactions.py:241 msgid "first_name" msgstr "prénom" -#: apps/note/models/transactions.py:247 +#: apps/note/models/transactions.py:246 msgid "bank" msgstr "banque" -#: apps/note/models/transactions.py:253 +#: apps/note/models/transactions.py:252 #: templates/activity/activity_entry.html:17 #: templates/note/transaction_form.html:24 msgid "Credit" msgstr "Crédit" -#: apps/note/models/transactions.py:253 templates/note/transaction_form.html:28 +#: apps/note/models/transactions.py:252 templates/note/transaction_form.html:28 msgid "Debit" msgstr "Débit" -#: apps/note/models/transactions.py:269 apps/note/models/transactions.py:274 +#: apps/note/models/transactions.py:268 apps/note/models/transactions.py:273 msgid "membership transaction" msgstr "Transaction d'adhésion" -#: apps/note/models/transactions.py:270 +#: apps/note/models/transactions.py:269 msgid "membership transactions" msgstr "Transactions d'adhésion" @@ -717,11 +717,11 @@ msgstr "Cliquez pour valider" msgid "No reason specified" msgstr "Pas de motif spécifié" -#: apps/note/tables.py:122 apps/note/tables.py:151 +#: apps/note/tables.py:122 apps/note/tables.py:152 msgid "Delete" msgstr "Supprimer" -#: apps/note/tables.py:146 templates/member/club_info.html:55 +#: apps/note/tables.py:147 templates/member/club_info.html:55 #: templates/note/conso_form.html:128 msgid "Edit" msgstr "Éditer" @@ -824,6 +824,7 @@ msgstr "Trésorerie" #: templates/activity/activity_invite.html:8 #: templates/django_filters/rest_framework/form.html:5 #: templates/member/add_members.html:14 templates/member/club_form.html:9 +#: templates/note/transactiontemplate_form.html:15 #: templates/treasury/invoice_form.html:46 msgid "Submit" msgstr "Envoyer" @@ -1317,22 +1318,30 @@ msgid "Current price" msgstr "Prix actuel" #: templates/note/transactiontemplate_list.html:9 -msgid "search button" +msgid "Search button" msgstr "Chercher un bouton" -#: templates/note/transactiontemplate_list.html:13 +#: templates/note/transactiontemplate_list.html:11 +msgid "Name of the button..." +msgstr "Nom du bouton ..." + +#: templates/note/transactiontemplate_list.html:16 +msgid "Display visible buttons only" +msgstr "N'afficher que les boutons visibles uniquement" + +#: templates/note/transactiontemplate_list.html:21 msgid "New button" msgstr "Nouveau bouton" -#: templates/note/transactiontemplate_list.html:20 +#: templates/note/transactiontemplate_list.html:28 msgid "buttons listing " msgstr "Liste des boutons" -#: templates/note/transactiontemplate_list.html:70 +#: templates/note/transactiontemplate_list.html:86 msgid "button successfully deleted " msgstr "Le bouton a bien été supprimé" -#: templates/note/transactiontemplate_list.html:74 +#: templates/note/transactiontemplate_list.html:90 msgid "Unable to delete button " msgstr "Impossible de supprimer le bouton " diff --git a/templates/note/transactiontemplate_form.html b/templates/note/transactiontemplate_form.html index 26cd97b5..e4bc42a7 100644 --- a/templates/note/transactiontemplate_form.html +++ b/templates/note/transactiontemplate_form.html @@ -12,10 +12,10 @@
{% csrf_token %} {{form|crispy}} - +
- {% if price_history %} + {% if price_history and price_history.1 %}

{% trans "Price history" %}

diff --git a/templates/note/transactiontemplate_list.html b/templates/note/transactiontemplate_list.html index cf9bc5ed..b298f58a 100644 --- a/templates/note/transactiontemplate_list.html +++ b/templates/note/transactiontemplate_list.html @@ -6,9 +6,17 @@

- {% trans "search button" %} + {% trans "Search button" %}

- + +
+
+ +
+

{% trans "New button" %}
@@ -29,50 +37,63 @@ {% block extrajavascript %} {% endblock %}