mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Admin Panel / Problems / Offices names the places accounts log in from - "London", with the country's flag - and a name is only useful if it leads somewhere. Clicking one now asks which map to open it at, from the same eleven providers a card's location offers. THE SAME CHOOSER, not a second one. The provider list was eleven options inside cardDetails.jade; it is client/components/main/mapProvider.jade now, and both callers include it. Two lists would be eleven places to add a provider instead of one, and they would disagree the first time only one was edited. The isMapProvider helper moves with it, so neither caller needs its own copy, and so do its styles - they were scoped to .js-card-location-form, which stopped being true the moment a second template used them. What the two do NOT share is the rest. A card's popup EDITS a location - name, address, coordinates, delete - and none of that applies to an office: its location arrived in a CDN header, WeKan did not ask for it and cannot correct it. So tablePageMapPopup is the map half alone: where this is, the link, the chooser, and a save that makes the choice the default for cards too, because profile.mapProvider is the one setting both read. A cell is a link only when the row HAS coordinates. A city name is not a position, and a map URL built from one would either search for the word or invent a place, so buildRows drops a location without lat/lon and the cell stays plain text. The link follows the selection BEFORE it is saved: choosing a provider and finding the link still pointing at the old one reads as broken. The handler lives on the shared table page, not on the report. That is also where the "clicking a user opens the Edit user popup" handler goes: three reports each had their own identical copy, because each was written where its own page was. A Blaze event bubbles through the template hierarchy, so one handler on tablePage reaches every report - and a report added later gets both without being told. Two things the guards caught, both worth naming. The popup had no title, which in WeKan means no header and so no close button; it opens with titleKey: 'location-open-map-at' - the phrase the chooser is already labelled with in every language - rather than adding a key to 154 files. And a comment between an `if` and its `else if` breaks jade nesting, which tests/jadeCompiles.test.cjs has a negative test for; the comments sit above the chain. Thanks to xet7 !
32 lines
2.1 KiB
Plaintext
32 lines
2.1 KiB
Plaintext
//- The "Open map links at" chooser, in ONE place.
|
|
//-
|
|
//- Two things need it and they are not near each other: a card's location popup,
|
|
//- where a location is entered, and Admin Panel / Problems / Offices, where a
|
|
//- location arrived in a CDN header and is only being looked at. Both offer the
|
|
//- same eleven providers in the same three regions, and both save to the same
|
|
//- `profile.mapProvider`, so a second copy of this list would be eleven options
|
|
//- to add a provider to instead of one - and the two would disagree the first
|
|
//- time only one was edited.
|
|
//-
|
|
//- The chooser is the SELECT alone. Saving is left to whoever included it,
|
|
//- because the two differ there: the card's popup saves it with the location it
|
|
//- is editing, and the Admin Panel one saves it on its own.
|
|
template(name="mapProviderSelect")
|
|
.map-provider-row
|
|
span.map-provider-label {{_ 'location-open-map-at'}}
|
|
select.js-map-provider
|
|
optgroup(label="{{_ 'map-region-usa'}}")
|
|
option(value="google" selected="{{#if isMapProvider 'google'}}selected{{/if}}") Google Maps
|
|
option(value="bing" selected="{{#if isMapProvider 'bing'}}selected{{/if}}") Bing Maps
|
|
option(value="apple" selected="{{#if isMapProvider 'apple'}}selected{{/if}}") Apple Maps
|
|
option(value="waze" selected="{{#if isMapProvider 'waze'}}selected{{/if}}") Waze
|
|
optgroup(label="{{_ 'map-region-europe'}}")
|
|
option(value="openstreetmap" selected="{{#if isMapProvider 'openstreetmap'}}selected{{/if}}") OpenStreetMap
|
|
option(value="here" selected="{{#if isMapProvider 'here'}}selected{{/if}}") HERE WeGo
|
|
option(value="yandex" selected="{{#if isMapProvider 'yandex'}}selected{{/if}}") Yandex Maps
|
|
option(value="mapy" selected="{{#if isMapProvider 'mapy'}}selected{{/if}}") Mapy.cz
|
|
option(value="2gis" selected="{{#if isMapProvider '2gis'}}selected{{/if}}") 2GIS
|
|
optgroup(label="{{_ 'map-region-asia'}}")
|
|
option(value="baidu" selected="{{#if isMapProvider 'baidu'}}selected{{/if}}") Baidu Maps
|
|
option(value="amap" selected="{{#if isMapProvider 'amap'}}selected{{/if}}") Amap (Gaode)
|