From 67ed6d5b44c3ee082a69f52ff1d829fd83850c69 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 23 Apr 2025 10:55:39 +0200 Subject: [PATCH] feat: add a back button in rules form To go back in rules list. fix #2631 --- umap/static/umap/js/modules/rules.js | 24 ++++++++++++++++++++---- umap/static/umap/js/modules/umap.js | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/umap/static/umap/js/modules/rules.js b/umap/static/umap/js/modules/rules.js index 4b7fc3a2..c00eae05 100644 --- a/umap/static/umap/js/modules/rules.js +++ b/umap/static/umap/js/modules/rules.js @@ -136,7 +136,21 @@ class Rule { .map((str) => `${value}${str || ''}`) } }) - this._umap.editPanel.open({ content: container, highlight: 'settings' }) + const backButton = Utils.loadTemplate(` + `) + backButton.addEventListener('click', () => + this._umap.edit().then(() => { + this._umap.editPanel.container.querySelector('details#rules').open = true + }) + ) + + this._umap.editPanel.open({ + content: container, + highlight: 'settings', + actions: [backButton], + }) } renderToolbox(ul) { @@ -213,10 +227,12 @@ export default class Rules { edit(container) { const template = ` -
+
${translate('Conditional style rules')} -
    - +
    +
      + +
      ` const [body, { ul, add }] = Utils.loadTemplateWithRefs(template) diff --git a/umap/static/umap/js/modules/umap.js b/umap/static/umap/js/modules/umap.js index e7a98085..61f4e120 100644 --- a/umap/static/umap/js/modules/umap.js +++ b/umap/static/umap/js/modules/umap.js @@ -1181,7 +1181,7 @@ export default class Umap { } this._advancedActions(container) - this.editPanel.open({ + return this.editPanel.open({ content: container, className: 'dark', highlight: 'settings',