Merge pull request #1751 from umap-project/browse-data-expanded

make that "browse data" opens the browser in expanded mode
This commit is contained in:
Yohan Boniface 2024-04-19 17:39:26 +02:00 committed by GitHub
commit 52ab531362
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 12 deletions

View file

@ -211,11 +211,9 @@ U.Map = L.Map.extend({
if (L.Util.queryString('share')) {
this.share.open()
} else if (this.options.onLoadPanel === 'databrowser') {
this.panel.mode = 'expanded'
this.openBrowser()
this.openBrowser('expanded')
} else if (this.options.onLoadPanel === 'datalayers') {
this.panel.mode = 'condensed'
this.openBrowser()
this.openBrowser('condensed')
} else if (this.options.onLoadPanel === 'caption') {
this.panel.mode = 'condensed'
this.displayCaption()
@ -909,7 +907,8 @@ U.Map = L.Map.extend({
}
},
openBrowser: function () {
openBrowser: function (mode) {
if (mode) this.panel.mode = mode
this.onceDatalayersLoaded(function () {
this.browser.open()
})
@ -1605,8 +1604,7 @@ U.Map = L.Map.extend({
'umap-open-browser-link flat',
container,
L._('Browse data'),
this.openBrowser,
this
() => this.openBrowser('expanded')
)
if (this.options.facetKey) {
L.DomUtil.createButton(
@ -1747,10 +1745,17 @@ U.Map = L.Map.extend({
})
}
}
items.push('-', {
text: L._('Browse data'),
callback: this.openBrowser,
})
items.push(
'-',
{
text: L._('See layers'),
callback: () => this.openBrowser('condensed'),
},
{
text: L._('Browse data'),
callback: () => this.openBrowser('expanded'),
}
)
if (this.options.facetKey) {
items.push({
text: L._('Facet search'),

View file

@ -40,7 +40,7 @@ def test_javascript_have_been_loaded(
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
expect(page).to_have_url(re.compile(r".*/fr/"))
# Should be in French, so hashed locale file has been loaded correctly
button = page.get_by_text("Voir les calques")
button = page.get_by_role("button", name="Voir les calques")
expect(button).to_be_visible()
button.click()
layers = page.locator(".umap-browser .datalayer")