mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
feat: add a back button in rules form (#2673)
To go back in rules list. fix #2631 
This commit is contained in:
commit
6687cd53ba
2 changed files with 21 additions and 5 deletions
|
@ -136,7 +136,21 @@ class Rule {
|
||||||
.map((str) => `${value}${str || ''}`)
|
.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) {
|
renderToolbox(ul) {
|
||||||
|
@ -215,10 +229,12 @@ export default class Rules {
|
||||||
|
|
||||||
edit(container) {
|
edit(container) {
|
||||||
const template = `
|
const template = `
|
||||||
<details>
|
<details id="rules">
|
||||||
<summary>${translate('Conditional style rules')}</summary>
|
<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>
|
<button class="umap-add" type="button" data-ref=add>${translate('Add rule')}</button>
|
||||||
|
</fieldset>
|
||||||
</details>
|
</details>
|
||||||
`
|
`
|
||||||
const [body, { ul, add }] = Utils.loadTemplateWithRefs(template)
|
const [body, { ul, add }] = Utils.loadTemplateWithRefs(template)
|
||||||
|
|
|
@ -1181,7 +1181,7 @@ export default class Umap {
|
||||||
}
|
}
|
||||||
this._advancedActions(container)
|
this._advancedActions(container)
|
||||||
|
|
||||||
this.editPanel.open({
|
return this.editPanel.open({
|
||||||
content: container,
|
content: container,
|
||||||
className: 'dark',
|
className: 'dark',
|
||||||
highlight: 'settings',
|
highlight: 'settings',
|
||||||
|
|
Loading…
Reference in a new issue