cleanup sharebox changes

* "data" moved to helptext
* drop css introduced in previous draft
* prettier.js
This commit is contained in:
Joachim Schleicher 2023-12-28 14:26:15 +01:00
parent 3f6c705d2e
commit dbf0179297
4 changed files with 17 additions and 10 deletions

View file

@ -227,8 +227,7 @@ button.flat,
font-size: 10px; font-size: 10px;
border-radius: 0 2px; border-radius: 0 2px;
} }
.content .helptext, .content .helptext {
#umap-ui-container .help-text {
background-color: #eee; background-color: #eee;
color: #000; color: #000;
} }
@ -410,7 +409,6 @@ input.switch:checked ~ label:after {
.umap-multiplechoice.by5 { .umap-multiplechoice.by5 {
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr;
} }
.button-bar.by4,
.umap-multiplechoice.by4 { .umap-multiplechoice.by4 {
grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr 1fr;
} }

View file

@ -1069,7 +1069,6 @@ L.U.TileLayerControl = L.Control.IconLayers.extend({
L.Control.IconLayers.prototype.setLayers.call(this, layers.slice(0, maxShown)) L.Control.IconLayers.prototype.setLayers.call(this, layers.slice(0, maxShown))
if (this.map.selected_tilelayer) this.setActiveLayer(this.map.selected_tilelayer) if (this.map.selected_tilelayer) this.setActiveLayer(this.map.selected_tilelayer)
}, },
}) })
/* Used in edit mode to define the default tilelayer */ /* Used in edit mode to define the default tilelayer */

View file

@ -55,7 +55,12 @@ L.U.Share = L.Class.extend({
() => navigator.clipboard.writeText(this.mapUrl.value), () => navigator.clipboard.writeText(this.mapUrl.value),
this this
) )
const mapUrlLabel = L.DomUtil.add('label', '', this.container, L._('Link to view the map')) const mapUrlLabel = L.DomUtil.add(
'label',
'',
this.container,
L._('Link to view the map')
)
this.mapUrl = L.DomUtil.create('input', 'umap-share-url', mapUrlLabel) this.mapUrl = L.DomUtil.create('input', 'umap-share-url', mapUrlLabel)
this.mapUrl.type = 'text' this.mapUrl.type = 'text'
this.mapUrl.readOnly = true this.mapUrl.readOnly = true
@ -80,27 +85,32 @@ L.U.Share = L.Class.extend({
L.DomUtil.create('hr', '', this.container) L.DomUtil.create('hr', '', this.container)
L.DomUtil.add('h4', '', this.container, L._('Download')) L.DomUtil.add('h4', '', this.container, L._('Download'))
L.DomUtil.add('small', 'label', this.container, L._('Only visible layers')) L.DomUtil.add('small', 'label', this.container, L._("Only visible layers' data"))
for (const key in this.EXPORT_TYPES) { for (const key in this.EXPORT_TYPES) {
if (this.EXPORT_TYPES.hasOwnProperty(key)) { if (this.EXPORT_TYPES.hasOwnProperty(key)) {
L.DomUtil.createButton( L.DomUtil.createButton(
'download-file', 'download-file',
this.container, this.container,
this.EXPORT_TYPES[key].name || key + ' data', this.EXPORT_TYPES[key].name || key,
() => this.download(key), () => this.download(key),
this this
) )
} }
} }
L.DomUtil.create('div', 'vspace', this.container) L.DomUtil.create('div', 'vspace', this.container)
L.DomUtil.add('small', 'label', this.container, L._('All data and settings of the map')) L.DomUtil.add(
'small',
'label',
this.container,
L._('All data and settings of the map')
)
const downloadUrl = L.Util.template(this.map.options.urls.map_download, { const downloadUrl = L.Util.template(this.map.options.urls.map_download, {
map_id: this.map.options.umap_id, map_id: this.map.options.umap_id,
}) })
const link = L.DomUtil.createLink( const link = L.DomUtil.createLink(
'download-backup', 'download-backup',
this.container, this.container,
L._('Download full backup'), L._('full backup'),
downloadUrl downloadUrl
) )
let name = this.map.options.name || 'data' let name = this.map.options.name || 'data'

View file

@ -9,7 +9,7 @@ pytestmark = pytest.mark.django_db
def test_umap_export(map, live_server, datalayer, page): def test_umap_export(map, live_server, datalayer, page):
page.goto(f"{live_server.url}{map.get_absolute_url()}?share") page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
link = page.get_by_role("link", name="Download full backup") link = page.get_by_role("link", name="full backup")
expect(link).to_be_visible() expect(link).to_be_visible()
with page.expect_download() as download_info: with page.expect_download() as download_info:
link.click() link.click()