1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-02-25 01:21:20 +00:00

Compare commits

..

No commits in common. "e479e1e3a42dacfec8e378e73183be9dcb86d690" and "38ca414ef6f618557930d2b91cef7df5e698f9dc" have entirely different histories.

3 changed files with 43 additions and 97 deletions

View File

@ -4,7 +4,7 @@
import html import html
import django_tables2 as tables import django_tables2 as tables
from django.utils.html import format_html, mark_safe from django.utils.html import format_html
from django_tables2.utils import A from django_tables2.utils import A
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from note_kfet.middlewares import get_current_request from note_kfet.middlewares import get_current_request
@ -197,16 +197,6 @@ class ButtonTable(tables.Table):
verbose_name=_("Edit"), verbose_name=_("Edit"),
) )
hideshow = tables.Column(
verbose_name= _("Hide/Show"),
accessor="pk",
attrs= {
'td': {
'class': 'col-sm-1',
'id': lambda record: "hideshow_" + str(record.pk),
}
})
delete_col = tables.TemplateColumn(template_code=DELETE_TEMPLATE, delete_col = tables.TemplateColumn(template_code=DELETE_TEMPLATE,
extra_context={"delete_trans": _('delete')}, extra_context={"delete_trans": _('delete')},
attrs={'td': {'class': 'col-sm-1'}}, attrs={'td': {'class': 'col-sm-1'}},
@ -214,13 +204,3 @@ class ButtonTable(tables.Table):
def render_amount(self, value): def render_amount(self, value):
return pretty_money(value) return pretty_money(value)
def render_hideshow(self, record):
val = '<button id="'
val += str(record.pk)
val += '" class="btn btn-secondary btn-sm" \
onclick="hideshow(' + str(record.id) + ',' + \
str(record.display).lower() + ')">'
val += str(_("Hide/Show"))
val += '</button>'
return mark_safe(val)

View File

@ -31,9 +31,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% block extrajavascript %} {% block extrajavascript %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() {
let searchbar_obj = $("#search_field");
let timer_on = false;
let timer;
function refreshMatchedWords() { function refreshMatchedWords() {
$("tr").each(function() { $("tr").each(function() {
let pattern = $('#search_field').val(); let pattern = searchbar_obj.val();
if (pattern) { if (pattern) {
$(this).find("td:eq(0), td:eq(1), td:eq(3), td:eq(6)").each(function () { $(this).find("td:eq(0), td:eq(1), td:eq(3), td:eq(6)").each(function () {
$(this).html($(this).text().replace(new RegExp(pattern, 'i'), "<mark>$&</mark>")); $(this).html($(this).text().replace(new RegExp(pattern, 'i'), "<mark>$&</mark>"));
@ -42,18 +47,13 @@ SPDX-License-Identifier: GPL-3.0-or-later
}); });
} }
refreshMatchedWords();
function reloadTable() { function reloadTable() {
let pattern = $('#search_field').val(); let pattern = searchbar_obj.val();
$("#buttons_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #buttons_table", refreshMatchedWords); $("#buttons_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #buttons_table", refreshMatchedWords);
} }
$(document).ready(function() {
let searchbar_obj = $("#search_field");
let timer_on = false;
let timer;
refreshMatchedWords();
searchbar_obj.keyup(function() { searchbar_obj.keyup(function() {
if (timer_on) if (timer_on)
clearTimeout(timer); clearTimeout(timer);
@ -77,28 +77,5 @@ SPDX-License-Identifier: GPL-3.0-or-later
addMsg('{% trans "Unable to delete button "%} #' + button_id, 'danger') addMsg('{% trans "Unable to delete button "%} #' + button_id, 'danger')
}); });
} }
// on click of button "hide/show", call the API
function hideshow(id, displayed) {
$.ajax({
url: '/api/note/transaction/template/' + id + '/',
type: 'PATCH',
dataType: 'json',
headers: {
'X-CSRFTOKEN': CSRF_TOKEN
},
data: {
display: !displayed
},
success: function() {
if(displayed)
addMsg("{% trans "Button hidden"%}", 'success', 1000)
else addMsg("{% trans "Button displayed"%}", 'success', 1000)
reloadTable()
},
error: function (err) {
addMsg("{% trans "An error occured"%}", 'danger')
}})
}
</script> </script>
{% endblock %} {% endblock %}

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-07 22:55+0200\n" "POT-Creation-Date: 2021-09-28 17:02+0200\n"
"PO-Revision-Date: 2020-11-16 20:02+0000\n" "PO-Revision-Date: 2020-11-16 20:02+0000\n"
"Last-Translator: Yohann D'ANELLO <ynerant@crans.org>\n" "Last-Translator: Yohann D'ANELLO <ynerant@crans.org>\n"
"Language-Team: French <http://translate.ynerant.fr/projects/nk20/nk20/fr/>\n" "Language-Team: French <http://translate.ynerant.fr/projects/nk20/nk20/fr/>\n"
@ -279,7 +279,7 @@ msgstr "Prénom"
msgid "Note" msgid "Note"
msgstr "Note" msgstr "Note"
#: apps/activity/tables.py:90 apps/member/tables.py:50 #: apps/activity/tables.py:90 apps/member/tables.py:49
msgid "Balance" msgid "Balance"
msgstr "Solde du compte" msgstr "Solde du compte"
@ -320,13 +320,13 @@ msgstr "Entrées"
msgid "Return to activity page" msgid "Return to activity page"
msgstr "Retour à la page de l'activité" msgstr "Retour à la page de l'activité"
#: apps/activity/templates/activity/activity_entry.html:94 #: apps/activity/templates/activity/activity_entry.html:89
#: apps/activity/templates/activity/activity_entry.html:129 #: apps/activity/templates/activity/activity_entry.html:124
msgid "Entry done, but caution: the user is not a Kfet member." msgid "Entry done, but caution: the user is not a Kfet member."
msgstr "" msgstr ""
"Entrée effectuée, mais attention : la personne n'est pas un adhérent Kfet." "Entrée effectuée, mais attention : la personne n'est pas un adhérent Kfet."
#: apps/activity/templates/activity/activity_entry.html:132 #: apps/activity/templates/activity/activity_entry.html:127
msgid "Entry done!" msgid "Entry done!"
msgstr "Entrée effectuée !" msgstr "Entrée effectuée !"
@ -404,33 +404,33 @@ msgstr "Créer une nouvelle activité"
msgid "Activities" msgid "Activities"
msgstr "Activités" msgstr "Activités"
#: apps/activity/views.py:93 #: apps/activity/views.py:95
msgid "Activity detail" msgid "Activity detail"
msgstr "Détails de l'activité" msgstr "Détails de l'activité"
#: apps/activity/views.py:113 #: apps/activity/views.py:115
msgid "Update activity" msgid "Update activity"
msgstr "Modifier l'activité" msgstr "Modifier l'activité"
#: apps/activity/views.py:140 #: apps/activity/views.py:142
msgid "Invite guest to the activity \"{}\"" msgid "Invite guest to the activity \"{}\""
msgstr "Invitation pour l'activité « {} »" msgstr "Invitation pour l'activité « {} »"
#: apps/activity/views.py:178 #: apps/activity/views.py:177
msgid "You are not allowed to display the entry interface for this activity." msgid "You are not allowed to display the entry interface for this activity."
msgstr "" msgstr ""
"Vous n'êtes pas autorisé à afficher l'interface des entrées pour cette " "Vous n'êtes pas autorisé à afficher l'interface des entrées pour cette "
"activité." "activité."
#: apps/activity/views.py:181 #: apps/activity/views.py:180
msgid "This activity does not support activity entries." msgid "This activity does not support activity entries."
msgstr "Cette activité ne requiert pas d'entrées." msgstr "Cette activité ne requiert pas d'entrées."
#: apps/activity/views.py:184 #: apps/activity/views.py:183
msgid "This activity is closed." msgid "This activity is closed."
msgstr "Cette activité est fermée." msgstr "Cette activité est fermée."
#: apps/activity/views.py:280 #: apps/activity/views.py:279
msgid "Entry for activity \"{}\"" msgid "Entry for activity \"{}\""
msgstr "Entrées pour l'activité « {} »" msgstr "Entrées pour l'activité « {} »"
@ -466,7 +466,7 @@ msgstr "nouvelles données"
msgid "create" msgid "create"
msgstr "créer" msgstr "créer"
#: apps/logs/models.py:65 apps/note/tables.py:165 apps/note/tables.py:211 #: apps/logs/models.py:65 apps/note/tables.py:165 apps/note/tables.py:201
#: apps/permission/models.py:127 apps/treasury/tables.py:38 #: apps/permission/models.py:127 apps/treasury/tables.py:38
#: apps/wei/tables.py:74 #: apps/wei/tables.py:74
msgid "delete" msgid "delete"
@ -850,33 +850,33 @@ msgstr "l'adhésion commence le"
msgid "membership ends on" msgid "membership ends on"
msgstr "l'adhésion finit le" msgstr "l'adhésion finit le"
#: apps/member/models.py:428 #: apps/member/models.py:422
#, python-brace-format #, python-brace-format
msgid "The role {role} does not apply to the club {club}." msgid "The role {role} does not apply to the club {club}."
msgstr "Le rôle {role} ne s'applique pas au club {club}." msgstr "Le rôle {role} ne s'applique pas au club {club}."
#: apps/member/models.py:437 apps/member/views.py:651 #: apps/member/models.py:431 apps/member/views.py:651
msgid "User is already a member of the club" msgid "User is already a member of the club"
msgstr "L'utilisateur est déjà membre du club" msgstr "L'utilisateur est déjà membre du club"
#: apps/member/models.py:449 apps/member/views.py:660 #: apps/member/models.py:443 apps/member/views.py:660
msgid "User is not a member of the parent club" msgid "User is not a member of the parent club"
msgstr "L'utilisateur n'est pas membre du club parent" msgstr "L'utilisateur n'est pas membre du club parent"
#: apps/member/models.py:502 #: apps/member/models.py:496
#, python-brace-format #, python-brace-format
msgid "Membership of {user} for the club {club}" msgid "Membership of {user} for the club {club}"
msgstr "Adhésion de {user} pour le club {club}" msgstr "Adhésion de {user} pour le club {club}"
#: apps/member/models.py:505 apps/note/models/transactions.py:389 #: apps/member/models.py:499 apps/note/models/transactions.py:389
msgid "membership" msgid "membership"
msgstr "adhésion" msgstr "adhésion"
#: apps/member/models.py:506 #: apps/member/models.py:500
msgid "memberships" msgid "memberships"
msgstr "adhésions" msgstr "adhésions"
#: apps/member/tables.py:139 #: apps/member/tables.py:137
msgid "Renew" msgid "Renew"
msgstr "Renouveler" msgstr "Renouveler"
@ -1535,7 +1535,7 @@ msgstr "Cliquez pour valider"
msgid "No reason specified" msgid "No reason specified"
msgstr "Pas de motif spécifié" msgstr "Pas de motif spécifié"
#: apps/note/tables.py:169 apps/note/tables.py:213 apps/treasury/tables.py:39 #: apps/note/tables.py:169 apps/note/tables.py:203 apps/treasury/tables.py:39
#: apps/treasury/templates/treasury/invoice_confirm_delete.html:30 #: apps/treasury/templates/treasury/invoice_confirm_delete.html:30
#: apps/treasury/templates/treasury/sogecredit_detail.html:65 #: apps/treasury/templates/treasury/sogecredit_detail.html:65
#: apps/wei/tables.py:75 apps/wei/tables.py:118 #: apps/wei/tables.py:75 apps/wei/tables.py:118
@ -1556,10 +1556,6 @@ msgstr "Supprimer"
msgid "Edit" msgid "Edit"
msgstr "Éditer" msgstr "Éditer"
#: apps/note/tables.py:201 apps/note/tables.py:224
msgid "Hide/Show"
msgstr "Afficher/Masquer"
#: apps/note/templates/note/conso_form.html:22 #: apps/note/templates/note/conso_form.html:22
#: apps/note/templates/note/transaction_form.html:48 #: apps/note/templates/note/transaction_form.html:48
msgid "Please select a note" msgid "Please select a note"
@ -1689,18 +1685,6 @@ msgstr "le bouton a bien été supprimé "
msgid "Unable to delete button " msgid "Unable to delete button "
msgstr "Impossible de supprimer le bouton " msgstr "Impossible de supprimer le bouton "
#: apps/note/templates/note/transactiontemplate_list.html:95
msgid "Button hidden"
msgstr "Bouton masqué"
#: apps/note/templates/note/transactiontemplate_list.html:96
msgid "Button displayed"
msgstr "Bouton affiché"
#: apps/note/templates/note/transactiontemplate_list.html:100
msgid "An error occured"
msgstr "Une erreur s'est produite"
#: apps/note/views.py:36 #: apps/note/views.py:36
msgid "Transfer money" msgid "Transfer money"
msgstr "Transférer de l'argent" msgstr "Transférer de l'argent"
@ -3517,3 +3501,8 @@ msgstr ""
"vous connecter. Vous devez vous rendre à la Kfet et payer les frais " "vous connecter. Vous devez vous rendre à la Kfet et payer les frais "
"d'adhésion. Vous devez également valider votre adresse email en suivant le " "d'adhésion. Vous devez également valider votre adresse email en suivant le "
"lien que vous avez reçu." "lien que vous avez reçu."
#~ msgid "You are not a Kfet member, so you can't use your note account."
#~ msgstr ""
#~ "Vous n'êtes pas adhérent Kfet, vous ne pouvez par conséquent pas utiliser "
#~ "votre compte note."