From d78f2e087e18320e19b508548c751d8f1519de57 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 31 Aug 2023 15:24:21 +0200 Subject: [PATCH] Restore help button icon While changing the edit header help link, I've changed all help buttons, which was not intended. --- umap/static/umap/js/umap.controls.js | 2 +- umap/static/umap/js/umap.core.js | 11 ++++++++--- umap/static/umap/map.css | 13 +++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index b5d729d9..8a2e785b 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -1010,7 +1010,7 @@ L.U.Map.include({ disable.href = '#' disable.textContent = L._('Disable editing') disable.title = `${disable.textContent} (Ctrl+E)` - this.help.button(container, 'edit') + this.help.link(container, 'edit') if (this.options.user) { const userLabel = L.DomUtil.add( 'a', diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 39420847..fdbf482a 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -428,10 +428,9 @@ L.U.Help = L.Class.extend({ return typeof this[name] === 'function' ? this[name]() : this[name] }, - button: function (container, entries) { - const helpButton = L.DomUtil.create('a', 'umap-help-button', container) + button: function (container, entries, classname) { + const helpButton = L.DomUtil.create('a', classname || 'umap-help-button', container) helpButton.href = '#' - helpButton.textContent = L._("Help") if (entries) { L.DomEvent.on(helpButton, 'click', L.DomEvent.stop).on( helpButton, @@ -446,6 +445,12 @@ L.U.Help = L.Class.extend({ return helpButton }, + link: function (container, entries) { + const helpButton = this.button(container, entries, 'umap-help-link') + helpButton.textContent = L._("Help") + return helpButton + }, + edit: function () { const container = L.DomUtil.create('div', ''), self = this, diff --git a/umap/static/umap/map.css b/umap/static/umap/map.css index d78477e4..8519b3e6 100644 --- a/umap/static/umap/map.css +++ b/umap/static/umap/map.css @@ -348,6 +348,19 @@ ul.photon-autocomplete { float: right; } .umap-help-button { + display: inline-block; + width: 16px; + height: 16px; + margin-left: 5px; + background-position: -4px -4px; + background-repeat: no-repeat; + background-image: url('./img/16.svg'); + vertical-align: middle; +} +.dark .umap-help-button { + background-image: url('./img/16-white.svg'); + } +.umap-help-link { float: right; margin-right: 20px; }