mirror of
https://github.com/umap-project/umap.git
synced 2025-05-01 04:22:24 +02:00
chore: make explicit that the "show get started dialog" is a special case
This commit is contained in:
parent
759dd34ef3
commit
6aa74060ad
2 changed files with 25 additions and 21 deletions
|
@ -190,14 +190,6 @@ export default class Help {
|
|||
show(entries) {
|
||||
const container = DomUtil.add('div')
|
||||
DomUtil.createTitle(container, translate('Help'))
|
||||
// Special dynamic case. Do we still think this dialog is usefull ?
|
||||
if (entries[0] === 'edit') {
|
||||
DomUtil.element({
|
||||
tagName: 'div',
|
||||
className: 'umap-help-entry',
|
||||
parent: container,
|
||||
}).appendChild(this._buildEditEntry())
|
||||
} else {
|
||||
for (const name of entries) {
|
||||
DomUtil.element({
|
||||
tagName: 'div',
|
||||
|
@ -206,7 +198,18 @@ export default class Help {
|
|||
innerHTML: ENTRIES[name],
|
||||
})
|
||||
}
|
||||
this.map.dialog.open({ content: container, className: 'dark' })
|
||||
}
|
||||
|
||||
// Special dynamic case. Do we still think this dialog is usefull ?
|
||||
showGetStarted() {
|
||||
const container = DomUtil.add('div')
|
||||
DomUtil.createTitle(container, translate('Where do we go from here?'))
|
||||
DomUtil.element({
|
||||
tagName: 'div',
|
||||
className: 'umap-help-entry',
|
||||
parent: container,
|
||||
}).appendChild(this._buildEditEntry())
|
||||
this.map.dialog.open({ content: container, className: 'dark' })
|
||||
}
|
||||
|
||||
|
@ -217,15 +220,18 @@ export default class Help {
|
|||
translate('Help')
|
||||
)
|
||||
entries = typeof entries === 'string' ? [entries] : entries
|
||||
DomEvent.on(button, 'click', DomEvent.stop).on(button, 'click', () =>
|
||||
DomEvent.on(button, 'click', DomEvent.stop).on(button, 'click', () => {
|
||||
this.show(entries)
|
||||
)
|
||||
})
|
||||
return button
|
||||
}
|
||||
|
||||
link(container, entries) {
|
||||
const button = this.button(container, entries, 'umap-help-link')
|
||||
getStartedLink(container) {
|
||||
const button = DomUtil.createButton('umap-help-link', container, translate('Help'))
|
||||
button.textContent = translate('Help')
|
||||
DomEvent.on(button, 'click', DomEvent.stop).on(button, 'click', () => {
|
||||
this.showGetStarted()
|
||||
})
|
||||
return button
|
||||
}
|
||||
|
||||
|
@ -237,16 +243,14 @@ export default class Help {
|
|||
|
||||
_buildEditEntry() {
|
||||
const container = DomUtil.create('div', '')
|
||||
const title = DomUtil.create('h4', '', container)
|
||||
const actionsContainer = DomUtil.create('ul', 'umap-edit-actions', container)
|
||||
const addAction = (action) => {
|
||||
const actionContainer = DomUtil.add('li', '', actionsContainer)
|
||||
DomUtil.add('i', action.options.className, actionContainer),
|
||||
DomUtil.add('i', action.options.className, actionContainer)
|
||||
DomUtil.add('span', '', actionContainer, action.options.tooltip)
|
||||
DomEvent.on(actionContainer, 'click', action.addHooks, action)
|
||||
DomEvent.on(actionContainer, 'click', this.map.dialog.close, this.map.dialog)
|
||||
}
|
||||
title.textContent = translate('Where do we go from here?')
|
||||
for (const id in this.map.helpMenuActions) {
|
||||
addAction(this.map.helpMenuActions[id])
|
||||
}
|
||||
|
|
|
@ -751,7 +751,7 @@ const ControlsMixin = {
|
|||
this.options.user.url
|
||||
)
|
||||
}
|
||||
this.help.link(rightContainer, 'edit')
|
||||
this.help.getStartedLink(rightContainer)
|
||||
const controlEditCancel = L.DomUtil.createButton(
|
||||
'leaflet-control-edit-cancel',
|
||||
rightContainer,
|
||||
|
|
Loading…
Reference in a new issue