feat: remove defaultPanelMode from now

After discussion, we prefer to go with decent defaults and see
how it goes.
This commit is contained in:
Yohan Boniface 2024-05-17 17:13:37 +02:00
parent c860866fe9
commit 284ef1d7f3
6 changed files with 5 additions and 41 deletions

View file

@ -2,11 +2,13 @@ import { DomUtil, DomEvent } from '../../vendors/leaflet/leaflet-src.esm.js'
import { translate } from './i18n.js' import { translate } from './i18n.js'
export class Panel { export class Panel {
constructor(map, mode = null) { constructor(map) {
this.parent = map._controlContainer this.parent = map._controlContainer
this.map = map this.map = map
this.container = DomUtil.create('div', '', this.parent) this.container = DomUtil.create('div', '', this.parent)
this.mode = mode // This will be set once according to the panel configurated at load
// or by using panels as popups
this.mode = null
this.classname = 'left' this.classname = 'left'
DomEvent.disableClickPropagation(this.container) DomEvent.disableClickPropagation(this.container)
DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu. DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu.

View file

@ -52,14 +52,6 @@ export const SCHEMA = {
label: translate('Display the data layers control'), label: translate('Display the data layers control'),
default: true, default: true,
}, },
defaultPanelMode: {
type: String,
label: translate('Default panel mode'),
choices: [
['condensed', translate('Condensed')],
['expanded', translate('Expanded')],
],
},
defaultView: { defaultView: {
type: String, type: String,
impacts: [], // no need to update the ui, only useful when loading the map impacts: [], // no need to update the ui, only useful when loading the map

View file

@ -56,7 +56,7 @@ U.Map = L.Map.extend({
if (geojson.geometry) this.options.center = this.latLng(geojson.geometry) if (geojson.geometry) this.options.center = this.latLng(geojson.geometry)
this.urls = new U.URLs(this.options.urls) this.urls = new U.URLs(this.options.urls)
this.panel = new U.Panel(this, this.options.defaultPanelMode) this.panel = new U.Panel(this)
if (this.hasEditMode()) { if (this.hasEditMode()) {
this.editPanel = new U.EditPanel(this) this.editPanel = new U.EditPanel(this)
this.fullPanel = new U.FullPanel(this) this.fullPanel = new U.FullPanel(this)
@ -1174,7 +1174,6 @@ U.Map = L.Map.extend({
'options.scaleControl', 'options.scaleControl',
'options.onLoadPanel', 'options.onLoadPanel',
'options.defaultView', 'options.defaultView',
'options.defaultPanelMode',
'options.displayPopupFooter', 'options.displayPopupFooter',
'options.captionBar', 'options.captionBar',
'options.captionMenus', 'options.captionMenus',

View file

@ -72,14 +72,6 @@ def test_data_browser_should_be_open(live_server, page, bootstrap, map):
expect(page.get_by_text("one polygon in greenland")).to_be_visible() expect(page.get_by_text("one polygon in greenland")).to_be_visible()
def test_can_force_panel_mode(live_server, page, bootstrap, map):
map.settings["properties"]["defaultPanelMode"] = "condensed"
map.save()
page.goto(f"{live_server.url}{map.get_absolute_url()}")
panel = page.locator(".panel.left.on")
expect(panel).to_have_class(re.compile(".*condensed.*"))
def test_data_browser_should_be_filterable(live_server, page, bootstrap, map): def test_data_browser_should_be_filterable(live_server, page, bootstrap, map):
page.goto(f"{live_server.url}{map.get_absolute_url()}") page.goto(f"{live_server.url}{map.get_absolute_url()}")
expect(page.get_by_title("Features in this layer: 3")).to_be_visible() expect(page.get_by_title("Features in this layer: 3")).to_be_visible()

View file

@ -25,12 +25,3 @@ def test_caption(live_server, page, map):
panel.locator(".datalayer-legend .off").get_by_text(non_loaded.name) panel.locator(".datalayer-legend .off").get_by_text(non_loaded.name)
).to_be_visible() ).to_be_visible()
expect(panel.locator(".datalayer-legend").get_by_text(hidden.name)).to_be_hidden() expect(panel.locator(".datalayer-legend").get_by_text(hidden.name)).to_be_hidden()
def test_can_force_panel_mode(live_server, page, map):
map.settings["properties"]["onLoadPanel"] = "caption"
map.settings["properties"]["defaultPanelMode"] = "expanded"
map.save()
page.goto(f"{live_server.url}{map.get_absolute_url()}")
panel = page.locator(".panel.left.on")
expect(panel).to_have_class(re.compile(".*expanded.*"))

View file

@ -79,15 +79,3 @@ def test_should_open_popup_panel_on_click(live_server, map, page, bootstrap):
# Close popup # Close popup
page.locator("#map").click() page.locator("#map").click()
expect(panel).to_be_hidden() expect(panel).to_be_hidden()
def test_can_force_popup_panel_mode(live_server, map, page, bootstrap):
map.settings["properties"]["popupShape"] = "Panel"
map.settings["properties"]["defaultPanelMode"] = "condensed"
map.save()
page.goto(f"{live_server.url}{map.get_absolute_url()}")
panel = page.locator(".panel.left.on")
expect(panel).to_be_hidden()
page.locator(".leaflet-marker-icon").click()
expect(panel).to_be_visible()
expect(panel).to_have_class(re.compile(".*condensed.*"))