From e877f0c1883acb7dd18c162b6532ee0991d70ca3 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Mon, 3 Jun 2024 08:54:02 +0200 Subject: [PATCH] Tweaks, show new location for a short moment --- feincms3/admin.py | 19 +++--- feincms3/locale/de/LC_MESSAGES/django.mo | Bin 6222 -> 6279 bytes feincms3/locale/de/LC_MESSAGES/django.po | 62 ++++++++++--------- feincms3/locale/en/LC_MESSAGES/django.po | 60 +++++++++--------- feincms3/locale/fr/LC_MESSAGES/django.po | 64 +++++++++++--------- feincms3/locale/it/LC_MESSAGES/django.po | 64 +++++++++++--------- feincms3/locale/nb_NO/LC_MESSAGES/django.po | 64 +++++++++++--------- feincms3/static/feincms3/admin.css | 7 ++- feincms3/static/feincms3/admin.js | 16 ++++- 9 files changed, 201 insertions(+), 155 deletions(-) diff --git a/feincms3/admin.py b/feincms3/admin.py index b240dd5..7491c16 100644 --- a/feincms3/admin.py +++ b/feincms3/admin.py @@ -61,16 +61,19 @@ class TreeAdmin(ModelAdmin): `_ trees. Shows the tree's hierarchy and adds a view to move nodes around. To use - this class the two columns ``indented_title`` and ``move_column`` should be - added to subclasses ``list_display``:: + this class the three columns ``collapse_column``, ``indented_title`` and + ``move_column`` should be added to subclasses ``list_display``:: class NodeAdmin(TreeAdmin): - list_display = ("indented_title", "move_column", ...) + list_display = [*TreeAdmin.list_display, ...] + # This is the default: + # list_display_links = ["indented_title"] admin.site.register(Node, NodeAdmin) """ - list_display = ("indented_title", "move_column") + list_display = ["collapse_column", "indented_title", "move_column"] + list_display_links = ["indented_title"] @csrf_protect_m def changelist_view(self, request, **kwargs): @@ -137,10 +140,10 @@ def move_column(self, instance): """\
- + --> @@ -151,7 +154,7 @@ def move_column(self, instance): instance.pk, _("Move '{}' to a new location").format(instance), instance.pk, - _("move"), + _("Choose new location"), _("before"), _("as first child"), _("as last child"), diff --git a/feincms3/locale/de/LC_MESSAGES/django.mo b/feincms3/locale/de/LC_MESSAGES/django.mo index 2e9428d1a1b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=D4&g_|)|ID6KHE*NdWOmAB zBW)%xAveu3>%m(6BZ!j5WFoc>_IfRj5SUYNY=DAZbR0F~LDYm!qb72}J->n);5ur>xA9Dp*+VR$-bDOIu^U(5 zU#!3qmahS~;e71GI@}i|{s$>srC|s&d8!A)ScET81ARrk@HZaDLYAc$j$jCHU>Cl^ z2$r+lD0bj|Jb{`>WllU2ow$(t{v6`3ka#q-;3ziZN8F8h^s2;TsOR^v9j8$fZOo0I zk$$YFehAfn92LnA$ee8o7vV3|mIkOO!lfPsb&Md_C2WI z^&yuX;ij!QkDONB%``<|eG)==YkF$!Gv&iM^Bpr)w~0o03wuAYl}QGu(M zp(YY`^;%T_dSq9v895?;(pDC_@_OXo<@q0;3My6ZK`GX|vO=!aY#=L)8i*~nFnKw- zk*w`f;tU$Q<{w1WwaP>)qM(DUR70-zOS-ZDYyVgDLE!H~)?r&oZXzcVA4WeZDv6{m z<0#lt*RTp3$Sm4FSH-xItPhaBF^RN>g0?5p%S{JHAyd*;DEyogKP}^4>&ilhZj-C) ntEmv{tEeqeDkq2hQv5TkBA*M3Uiy*xdLou~Cu3qLn4JC(fEIGg diff --git a/feincms3/locale/de/LC_MESSAGES/django.po b/feincms3/locale/de/LC_MESSAGES/django.po index d29cb8c..fef12f6 100644 --- a/feincms3/locale/de/LC_MESSAGES/django.po +++ b/feincms3/locale/de/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: feincms\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-02 19:46+0200\n" +"POT-Creation-Date: 2024-06-03 08:51+0200\n" "PO-Revision-Date: 2020-12-04 09:43+0000\n" "Last-Translator: J. Lavoie \n" "Language-Team: German \n" "Language-Team: LANGUAGE \n" @@ -18,108 +18,112 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: admin.py:129 pages.py:84 +#: admin.py:132 pages.py:84 msgid "title" msgstr "" -#: admin.py:152 +#: admin.py:155 msgid "Move '{}' to a new location" msgstr "" -#: admin.py:154 admin.py:168 admin.py:171 -msgid "move" +#: admin.py:157 +msgid "Choose new location" msgstr "" -#: admin.py:155 +#: admin.py:158 msgid "before" msgstr "" -#: admin.py:156 +#: admin.py:159 msgid "as first child" msgstr "" -#: admin.py:157 +#: admin.py:160 msgid "as last child" msgstr "" -#: admin.py:158 +#: admin.py:161 msgid "after" msgstr "" -#: admin.py:203 +#: admin.py:171 admin.py:174 +msgid "move" +msgstr "" + +#: admin.py:206 #, python-format msgid "Move %s" msgstr "" -#: admin.py:208 +#: admin.py:211 #, python-format msgid "Clone %s" msgstr "" -#: admin.py:273 +#: admin.py:276 msgid "Invalid node move request." msgstr "" -#: admin.py:296 +#: admin.py:301 msgid "Error while validating the new position of '{}'." msgstr "" -#: admin.py:327 +#: admin.py:334 msgid "Node '{}' has been moved to its new position." msgstr "" -#: admin.py:352 +#: admin.py:362 msgid "New location" msgstr "" -#: admin.py:360 +#: admin.py:370 msgid "" "Moving isn't possible because there are no valid targets. Maybe you selected " "the only root node?" msgstr "" -#: admin.py:406 admin.py:417 admin.py:427 +#: admin.py:416 admin.py:427 admin.py:437 msgid "move here" msgstr "" -#: admin.py:489 +#: admin.py:499 #, python-format msgid "The node %(node)s has been moved to the new position." msgstr "" -#: admin.py:507 +#: admin.py:517 msgid "target" msgstr "" -#: admin.py:517 +#: admin.py:527 msgid "Replace target's content" msgstr "" -#: admin.py:519 +#: admin.py:529 #, python-format msgid "Affects the following models: %s." msgstr "" -#: admin.py:541 +#: admin.py:551 #, python-format msgid "Current: \"%s\"" msgstr "" -#: admin.py:551 +#: admin.py:561 msgid "Cannot clone node to itself." msgstr "" -#: admin.py:574 +#: admin.py:584 #, python-format msgid "Updated fields of %(node)s: %(fields)s" msgstr "" -#: admin.py:598 +#: admin.py:608 #, python-format msgid "Replaced the content of %(target)s with the contents of %(source)s." msgstr "" -#: admin.py:625 +#: admin.py:635 msgid "subtree" msgstr "" @@ -228,11 +232,11 @@ msgstr "" msgid "pages" msgstr "" -#: pages.py:167 +#: pages.py:171 msgid "Static paths cannot be empty. Did you mean '/'?" msgstr "" -#: pages.py:189 +#: pages.py:193 #, python-format msgid "The page %(page)s's new path %(path)s would not be unique." msgstr "" diff --git a/feincms3/locale/fr/LC_MESSAGES/django.po b/feincms3/locale/fr/LC_MESSAGES/django.po index a83edbf..e6455fa 100644 --- a/feincms3/locale/fr/LC_MESSAGES/django.po +++ b/feincms3/locale/fr/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: feincms\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-02 19:46+0200\n" +"POT-Creation-Date: 2024-06-03 08:51+0200\n" "PO-Revision-Date: 2020-12-04 09:43+0000\n" "Last-Translator: J. Lavoie \n" "Language-Team: French 1;\n" "X-Generator: Weblate 4.4-dev\n" -#: admin.py:129 pages.py:84 +#: admin.py:132 pages.py:84 msgid "title" msgstr "titre" -#: admin.py:152 +#: admin.py:155 msgid "Move '{}' to a new location" msgstr "" -#: admin.py:154 admin.py:168 admin.py:171 -msgid "move" -msgstr "déplacer" +#: admin.py:157 +#, fuzzy +#| msgid "New location" +msgid "Choose new location" +msgstr "Nouvel emplacement" -#: admin.py:155 +#: admin.py:158 msgid "before" msgstr "" -#: admin.py:156 +#: admin.py:159 #, fuzzy #| msgid "first child" msgid "as first child" msgstr "erstes Kind" -#: admin.py:157 +#: admin.py:160 #, fuzzy #| msgid "last child" msgid "as last child" msgstr "letztes Kind" -#: admin.py:158 +#: admin.py:161 msgid "after" msgstr "" -#: admin.py:203 +#: admin.py:171 admin.py:174 +msgid "move" +msgstr "déplacer" + +#: admin.py:206 #, python-format msgid "Move %s" msgstr "Déplacer %s" -#: admin.py:208 +#: admin.py:211 #, python-format msgid "Clone %s" msgstr "Cloner %s" -#: admin.py:273 +#: admin.py:276 msgid "Invalid node move request." msgstr "" -#: admin.py:296 +#: admin.py:301 msgid "Error while validating the new position of '{}'." msgstr "" -#: admin.py:327 +#: admin.py:334 #, fuzzy #| msgid "The node %(node)s has been moved to the new position." msgid "Node '{}' has been moved to its new position." msgstr "Le nœud %(node)s a été déplacé vers la nouvelle position." -#: admin.py:352 +#: admin.py:362 msgid "New location" msgstr "Nouvel emplacement" -#: admin.py:360 +#: admin.py:370 msgid "" "Moving isn't possible because there are no valid targets. Maybe you selected " "the only root node?" @@ -89,48 +95,48 @@ msgstr "" "Le déplacement n’est pas possible car il n’y a pas de cibles valides. Peut-" "être avez-vous sélectionné le seul nœud racine ?" -#: admin.py:406 admin.py:417 admin.py:427 +#: admin.py:416 admin.py:427 admin.py:437 msgid "move here" msgstr "déplacer ici" -#: admin.py:489 +#: admin.py:499 #, python-format msgid "The node %(node)s has been moved to the new position." msgstr "Le nœud %(node)s a été déplacé vers la nouvelle position." -#: admin.py:507 +#: admin.py:517 msgid "target" msgstr "cible" -#: admin.py:517 +#: admin.py:527 msgid "Replace target's content" msgstr "Remplacer le contenu de la cible" -#: admin.py:519 +#: admin.py:529 #, python-format msgid "Affects the following models: %s." msgstr "Affecte les modèles suivants : %s." -#: admin.py:541 +#: admin.py:551 #, python-format msgid "Current: \"%s\"" msgstr "Actuel : « %s »" -#: admin.py:551 +#: admin.py:561 msgid "Cannot clone node to itself." msgstr "Impossible de cloner le nœud sur lui-même." -#: admin.py:574 +#: admin.py:584 #, python-format msgid "Updated fields of %(node)s: %(fields)s" msgstr "Champs mis à jour de %(node)s : %(fields)s" -#: admin.py:598 +#: admin.py:608 #, python-format msgid "Replaced the content of %(target)s with the contents of %(source)s." msgstr "Remplacement du contenu de %(target)s par le contenu de %(source)s." -#: admin.py:625 +#: admin.py:635 msgid "subtree" msgstr "" @@ -245,12 +251,12 @@ msgstr "page" msgid "pages" msgstr "pages" -#: pages.py:167 +#: pages.py:171 msgid "Static paths cannot be empty. Did you mean '/'?" msgstr "" "Les chemins statiques ne peuvent pas être vides. Vouliez-vous dire « / » ?" -#: pages.py:189 +#: pages.py:193 #, python-format msgid "The page %(page)s's new path %(path)s would not be unique." msgstr "Le nouveau chemin %(path)s de la page %(page)s ne serait pas unique." diff --git a/feincms3/locale/it/LC_MESSAGES/django.po b/feincms3/locale/it/LC_MESSAGES/django.po index 77b99a8..dc49908 100644 --- a/feincms3/locale/it/LC_MESSAGES/django.po +++ b/feincms3/locale/it/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: feincms\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-02 19:46+0200\n" +"POT-Creation-Date: 2024-06-03 08:51+0200\n" "PO-Revision-Date: 2020-12-04 09:43+0000\n" "Last-Translator: J. Lavoie \n" "Language-Team: Italian \n" "Language-Team: Norwegian Bokmål { document.addEventListener("DOMContentLoaded", () => { let statusElement + const showMoving = (moving) => { if (!statusElement) { statusElement = document.createElement("div") @@ -73,7 +74,18 @@ document.addEventListener("DOMContentLoaded", () => { for (const el of document.querySelectorAll(".move-selected")) el.classList.remove("move-selected") - if (moving) { + if (moving?.highlight) { + const row = document + .querySelector(`[data-pk="${moving.pk}"]`) + .closest("tr") + + row.classList.add("move-highlight") + + setTimeout(() => { + row.classList.remove("move-highlight") + setMoving(null) + }, 1000) + } else if (moving) { statusElement.textContent = `${moving.title} (click here to cancel)` statusElement.style.display = "block" document.body.classList.add("moving") @@ -121,7 +133,7 @@ document.addEventListener("DOMContentLoaded", () => { method: "POST", body, }).then(() => { - setMoving(null) + setMoving({ ..._moving, highlight: true }) window.location.reload() })