Skip to content

Commit

Permalink
fix: use correct icon for layer download advanced action (#2224)
Browse files Browse the repository at this point in the history
Replace #2221
  • Loading branch information
yohanboniface authored Oct 21, 2024
2 parents 037b8e0 + a1a4904 commit e100809
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions umap/static/umap/img/24-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions umap/static/umap/img/24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions umap/static/umap/img/source/24-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions umap/static/umap/img/source/24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions umap/static/umap/js/modules/data/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,13 +802,12 @@ export class DataLayer {
this
)
if (this.umap_id) {
const download = DomUtil.createLink(
'button umap-download',
advancedButtons,
translate('Download'),
this._dataUrl(),
'_blank'
)
const filename = Utils.slugify(this.options.name)
const download = Utils.loadTemplate(`
<a class="button" href="${this._dataUrl()}" download="${filename}">
<i class="icon icon-24 icon-download"></i>${translate('Download')}
</a>`)
advancedButtons.appendChild(download)
}
const backButton = DomUtil.createButtonIcon(
undefined,
Expand Down
4 changes: 1 addition & 3 deletions umap/static/umap/js/modules/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ export default class Share {
async format(mode) {
const type = EXPORT_FORMATS[mode]
const content = await type.formatter(this.map)
let name = this.map.options.name || 'data'
name = name.replace(/[^a-z0-9]/gi, '_').toLowerCase()
const filename = name + type.ext
const filename = Utils.slugify(this.map.options.name) + type.ext
return { content, filetype: type.filetype, filename }
}

Expand Down
6 changes: 5 additions & 1 deletion umap/static/umap/js/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ export class WithTemplate {
}
}

export function deepEqual(object1, object2){
export function deepEqual(object1, object2) {
return JSON.stringify(object1) === JSON.stringify(object2)
}

export function slugify(str) {
return (str || 'data').replace(/[^a-z0-9]/gi, '_').toLowerCase()
}

0 comments on commit e100809

Please sign in to comment.