mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 11:32:38 +02:00
feat: add a back button in rules form
To go back in rules list. fix #2631
This commit is contained in:
parent
3f5d282477
commit
67ed6d5b44
2 changed files with 21 additions and 5 deletions
|
@ -136,7 +136,21 @@ class Rule {
|
|||
.map((str) => `${value}${str || ''}`)
|
||||
}
|
||||
})
|
||||
this._umap.editPanel.open({ content: container, highlight: 'settings' })
|
||||
const backButton = Utils.loadTemplate(`
|
||||
<button class="flat" type="button" data-ref="add">
|
||||
<i class="icon icon-16 icon-back" title="${translate('Back to list')}"></i>
|
||||
</button>`)
|
||||
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 = `
|
||||
<details>
|
||||
<details id="rules">
|
||||
<summary>${translate('Conditional style rules')}</summary>
|
||||
<fieldset><ul data-ref=ul></ul></fieldset>
|
||||
<fieldset>
|
||||
<ul data-ref=ul></ul>
|
||||
<button class="umap-add" type="button" data-ref=add>${translate('Add rule')}</button>
|
||||
</fieldset>
|
||||
</details>
|
||||
`
|
||||
const [body, { ul, add }] = Utils.loadTemplateWithRefs(template)
|
||||
|
|
|
@ -1181,7 +1181,7 @@ export default class Umap {
|
|||
}
|
||||
this._advancedActions(container)
|
||||
|
||||
this.editPanel.open({
|
||||
return this.editPanel.open({
|
||||
content: container,
|
||||
className: 'dark',
|
||||
highlight: 'settings',
|
||||
|
|
Loading…
Reference in a new issue