Many tweaks to use MC in an iframe with less clutter

This commit is contained in:
Pieter Vander Vennet 2024-06-27 17:37:34 +02:00
parent 894b0d45ca
commit f88cb9a730
19 changed files with 384 additions and 236 deletions

View file

@ -37,18 +37,19 @@ This document gives an overview of which URL-parameters can be used to influence
22. [ overpassMaxZoom ](#-overpassmaxzoom-)
23. [ osmApiTileSize ](#-osmapitilesize-)
24. [ background ](#-background-)
25. [ z ](#-z-)
26. [ lat ](#-lat-)
27. [ lon ](#-lon-)
28. [ oauth_token ](#-oauth_token-)
29. [ layer-public_bookcase ](#-layer-public_bookcase-)
30. [ filter-public_bookcase-kid-books ](#-filter-public_bookcase-kid-books-)
31. [ filter-public_bookcase-adult-books ](#-filter-public_bookcase-adult-books-)
32. [ filter-public_bookcase-inside ](#-filter-public_bookcase-inside-)
33. [ filter-public_bookcase-has_image ](#-filter-public_bookcase-has_image-)
34. [ layer-note_import_public_bookcase ](#-layer-note_import_public_bookcase-)
35. [ mode ](#-mode-)
36. [ layer-<layer-id> ](#-layer-<layer-id>-)
25. [ fs-layers-enabled ](#-fs-layers-enabled-)
26. [ z ](#-z-)
27. [ lat ](#-lat-)
28. [ lon ](#-lon-)
29. [ oauth_token ](#-oauth_token-)
30. [ layer-public_bookcase ](#-layer-public_bookcase-)
31. [ filter-public_bookcase-kid-books ](#-filter-public_bookcase-kid-books-)
32. [ filter-public_bookcase-adult-books ](#-filter-public_bookcase-adult-books-)
33. [ filter-public_bookcase-inside ](#-filter-public_bookcase-inside-)
34. [ filter-public_bookcase-has_image ](#-filter-public_bookcase-has_image-)
35. [ layer-note_import_public_bookcase ](#-layer-note_import_public_bookcase-)
36. [ mode ](#-mode-)
37. [ layer-<layer-id> ](#-layer-<layer-id>-)
What is a URL parameter?
--------------------------
@ -145,7 +146,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables logging in and thus disables editing all together. This effectively puts MapComplete into read-only mode.
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L100)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L99)
The default value is _true_
@ -156,7 +157,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the search bar
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L115)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L114)
The default value is _true_
@ -167,7 +168,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the background layer control where a user can enable e.g. aerial imagery
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L120)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L119)
The default value is _true_
@ -178,7 +179,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the filter view where a user can enable/disable MapComplete-layers or filter for certain properties
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L126)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L125)
The default value is _true_
@ -189,7 +190,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/enables the help menu or welcome message
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L132)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L131)
The default value is _true_
@ -200,7 +201,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/enables the button to get in touch with the community
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L137)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L136)
The default value is _true_
@ -211,7 +212,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the extraLink button. By default, if in iframe mode and the welcome message is hidden, a popout button to the full mapcomplete instance is shown instead (unless disabled with this switch or another extraLink button is enabled)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L142)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L141)
The default value is _true_
@ -222,7 +223,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the various links which go back to the index page with the theme overview
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L147)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L146)
The default value is _true_
@ -233,7 +234,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the 'Share-screen'-tab in the welcome message
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L152)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L151)
The default value is _true_
@ -244,7 +245,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Disables/Enables the geolocation button
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L157)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L156)
The default value is _true_
@ -255,7 +256,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Always show all questions
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L162)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L161)
The default value is _false_
@ -266,7 +267,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Enable the export as GeoJSON and CSV button
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L168)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L167)
The default value is _true_
@ -277,7 +278,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L182)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L181)
The default value is _false_
@ -288,7 +289,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
If true, shows some extra debugging help such as all the available tags on every object
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L188)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L187)
The default value is _false_
@ -299,7 +300,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
If true, the location distance indication will not be written to the changeset and other privacy enhancing measures might be taken.
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L194)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L193)
The default value is _false_
@ -310,7 +311,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L200)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L199)
The default value is _https://overpass-api.de/api/interpreter,https://overpass.kumi.systems/api/interpreter,https://overpass.openstreetmap.ru/cgi/interpreter_
@ -321,7 +322,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Set a different timeout (in seconds) for queries in overpass
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L211)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L210)
The default value is _30_
@ -332,7 +333,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
point to switch between OSM-api and overpass
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L219)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L218)
The default value is _16_
@ -343,7 +344,7 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
Tilesize when the OSM-API is used to fetch data within a BBOX
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L227)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L226)
The default value is _17_
@ -354,12 +355,23 @@ This documentation is defined in the source code at [FeatureSwitchState.ts](/src
The id of the background layer to start with
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L234)
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L233)
No default value set
fs-layers-enabled
-------------------
If set to false, all layers will be disabled - except the explicitly enabled layers
This documentation is defined in the source code at [FeatureSwitchState.ts](/src/Logic/State/FeatureSwitchState.ts#L239)
The default value is _true_
z
---
@ -398,7 +410,7 @@ This documentation is defined in the source code at [InitialMapPositioning.ts](/
Used to complete the login
This documentation is defined in the source code at [ThemeViewState.ts](/src/Models/ThemeViewState.ts#L168)
This documentation is defined in the source code at [ThemeViewState.ts](/src/Models/ThemeViewState.ts#L174)
No default value set
@ -409,7 +421,7 @@ This documentation is defined in the source code at [ThemeViewState.ts](/src/Mod
Whether or not layer public_bookcase is shown
This documentation is defined in the source code at [FilteredLayer.ts](/src/Models/FilteredLayer.ts#L105)
This documentation is defined in the source code at [FilteredLayer.ts](/src/Models/FilteredLayer.ts#L110)
The default value is _true_
@ -464,7 +476,7 @@ This documentation is defined in the source code at [FilterConfig.ts](/src/Model
Whether or not layer note_import_public_bookcase is shown
This documentation is defined in the source code at [FilteredLayer.ts](/src/Models/FilteredLayer.ts#L105)
This documentation is defined in the source code at [FilteredLayer.ts](/src/Models/FilteredLayer.ts#L110)
The default value is _true_

View file

@ -2743,6 +2743,7 @@
"_last_edit:passed_time>=300"
]
},
"metacondition": "__featureSwitchEnableLogin=true",
"render": {
"special": {
"type": "if_nothing_known",

View file

@ -1,6 +1,6 @@
{
"id": "summary",
"description": "Special layer which shows `count`",
"description": "Special layer which shows `count`, probably provided by the clustering server or some clustering algorithm",
"source": "special",
"title": {
"render": {
@ -16,7 +16,14 @@
"centroid"
],
"iconSize": "40,40",
"label": "{total_metric}",
"label": {
"mappings": [
{
"if": "total_metric!=0",
"then": "{total_metric}"
}
]
},
"labelCss": "background: #ffffffbb",
"labelCssClasses": "w-12 text-lg rounded-xl p-1 px-2"
}

View file

@ -116,7 +116,8 @@
"centroid"
]
}
]
],
"isCounted": false
}
},
{
@ -152,7 +153,8 @@
"filter": {
"sameAs": "charging_station_ebikes"
},
"minzoom": 18
"minzoom": 18,
"isCounted": false
}
},
{
@ -178,7 +180,8 @@
"filter": {
"sameAs": "vending_machine_bicycle"
},
"minzoom": 18
"minzoom": 18,
"isCounted": false
}
}
],

View file

@ -1,13 +1,20 @@
{
"id": "mapcomplete-changes",
"title": {
"en": "Changes made with MapComplete"
"en": "Changes made with MapComplete",
"da": "Ændringer lavet med MapComplete",
"de": "Änderungen mit MapComplete"
},
"shortDescription": {
"en": "Shows changes made by MapComplete"
"en": "Shows changes made by MapComplete",
"da": "Vis ændringer lavet med MapComplete",
"de": "Änderungen von MapComplete anzeigen"
},
"description": {
"en": "This maps shows all the changes made with MapComplete"
"en": "This maps shows all the changes made with MapComplete",
"da": "Dette kort viser alle ændringer foretaget med MapComplete",
"de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen",
"pl": "Ta mapa pokazuje wszystkie zmiany wprowadzone za pomocą MapComplete"
},
"icon": "./assets/svg/logo.svg",
"hideFromOverview": true,
@ -18,7 +25,9 @@
{
"id": "mapcomplete-changes",
"name": {
"en": "Changeset centers"
"en": "Changeset centers",
"de": "Zentrum der Änderungssätze",
"zh_Hant": "變更集中心"
},
"minzoom": 0,
"source": {
@ -28,41 +37,51 @@
},
"title": {
"render": {
"en": "Changeset for {theme}"
"en": "Changeset for {theme}",
"de": "Änderungssatz für {theme}"
}
},
"description": {
"en": "Shows all MapComplete changes"
"en": "Shows all MapComplete changes",
"da": "Vis alle MapComplete-ændringer",
"de": "Alle MapComplete-Änderungen anzeigen"
},
"tagRenderings": [
{
"id": "show_changeset_id",
"render": {
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
"de": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
}
},
{
"id": "contributor",
"question": {
"en": "What contributor did make this change?"
"en": "What contributor did make this change?",
"da": "Hvilke bidragsydere lavede denne ændring?",
"de": "Welcher Mitwirkende hat diese Änderung vorgenommen?"
},
"freeform": {
"key": "user"
},
"render": {
"en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
"en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>",
"da": "Ændring lavet af <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>",
"de": "Änderung vorgenommen von <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
}
},
{
"id": "theme-id",
"question": {
"en": "What theme was used to make this change?"
"en": "What theme was used to make this change?",
"de": "Welches Thema wurde für die Änderung verwendet?"
},
"freeform": {
"key": "theme"
},
"render": {
"en": "Change with theme <a href='https://mapcomplete.org/{theme}'>{theme}</a>"
"en": "Change with theme <a href='https://mapcomplete.org/{theme}'>{theme}</a>",
"de": "Geändert mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
}
},
{
@ -71,19 +90,23 @@
"key": "locale"
},
"question": {
"en": "What locale (language) was this change made in?"
"en": "What locale (language) was this change made in?",
"de": "In welcher Benutzersprache wurde die Änderung vorgenommen?"
},
"render": {
"en": "User locale is {locale}"
"en": "User locale is {locale}",
"de": "Benutzersprache {locale}"
}
},
{
"id": "host",
"render": {
"en": "Change with with <a href='{host}'>{host}</a>"
"en": "Change with with <a href='{host}'>{host}</a>",
"de": "Änderung über <a href='{host}'>{host}</a>"
},
"question": {
"en": "What host (website) was this change made with?"
"en": "What host (website) was this change made with?",
"de": "Über welchen Host (Webseite) wurde diese Änderung vorgenommen?"
},
"freeform": {
"key": "host"
@ -104,10 +127,13 @@
{
"id": "version",
"question": {
"en": "What version of MapComplete was used to make this change?"
"en": "What version of MapComplete was used to make this change?",
"de": "Mit welcher MapComplete Version wurde die Änderung vorgenommen?"
},
"render": {
"en": "Made with {editor}"
"en": "Made with {editor}",
"da": "Lavet med {editor}",
"de": "Erstellt mit {editor}"
},
"freeform": {
"key": "editor"
@ -493,7 +519,10 @@
}
],
"question": {
"en": "Themename contains {search}"
"en": "Themename contains {search}",
"da": "Temanavn indeholder {search}",
"de": "Themenname enthält {search}",
"pl": "Nazwa tematu zawiera {search}"
}
}
]
@ -509,7 +538,9 @@
}
],
"question": {
"en": "Themename does <b>not</b> contain {search}"
"en": "Themename does <b>not</b> contain {search}",
"da": "Temanavn indeholder <b>ikke</b> {search}",
"de": "Themename enthält <b>not</b> {search}"
}
}
]
@ -525,7 +556,9 @@
}
],
"question": {
"en": "Made by contributor {search}"
"en": "Made by contributor {search}",
"da": "Lavet af bidragsyder {search}",
"de": "Erstellt vom Mitwirkenden {search}"
}
}
]
@ -541,7 +574,9 @@
}
],
"question": {
"en": "<b>Not</b> made by contributor {search}"
"en": "<b>Not</b> made by contributor {search}",
"da": "<b>Ikke</b> lavet af bidragsyder {search}",
"de": "<b>Nicht</b> erstellt von Mitwirkendem {search}"
}
}
]
@ -558,7 +593,9 @@
}
],
"question": {
"en": "Made before {search}"
"en": "Made before {search}",
"da": "Lavet før {search}",
"de": "Erstellt vor {search}"
}
}
]
@ -575,7 +612,9 @@
}
],
"question": {
"en": "Made after {search}"
"en": "Made after {search}",
"da": "Lavet efter {search}",
"de": "Erstellt nach {search}"
}
}
]
@ -591,7 +630,8 @@
}
],
"question": {
"en": "User language (iso-code) {search}"
"en": "User language (iso-code) {search}",
"de": "Benutzersprache (ISO-Code) {search}"
}
}
]
@ -607,7 +647,8 @@
}
],
"question": {
"en": "Made with host {search}"
"en": "Made with host {search}",
"de": "Erstellt mit Host {search}"
}
}
]
@ -618,7 +659,8 @@
{
"osmTags": "add-image>0",
"question": {
"en": "Changeset added at least one image"
"en": "Changeset added at least one image",
"de": "Änderungssatz hat mindestens ein Bild hinzugefügt"
}
}
]
@ -629,7 +671,8 @@
{
"osmTags": "theme!=grb",
"question": {
"en": "Exclude GRB theme"
"en": "Exclude GRB theme",
"de": "GRB-Thema ausschließen"
}
}
]
@ -640,7 +683,8 @@
{
"osmTags": "theme!=etymology",
"question": {
"en": "Exclude etymology theme"
"en": "Exclude etymology theme",
"de": "Etymologie-Thema ausschließen"
}
}
]
@ -655,7 +699,8 @@
{
"id": "link_to_more",
"render": {
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>",
"de": "Weitere Statistiken gibt es <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
}
},
{

View file

@ -59,7 +59,7 @@
"currentInOsmIs": "Momentan hat OpenStreetMap den folgenden Wert erfasst:",
"done": "Fertig",
"error": "Verknüpfte Daten konnten nicht von der Website geladen werden",
"lastModified": "Die externen Daten wurden zuletzt am {Datum} geändert",
"lastModified": "Die externen Daten wurden zuletzt am {date} geändert",
"loadedFrom": "Die folgenden Daten werden von <a href={url}>{source}</a> unter Verwendung des eingebetteten JSON-LD geladen",
"missing": {
"intro": "OpenStreetMap hat keine Informationen über die folgenden Attribute",

View file

@ -322,6 +322,7 @@
"openStreetMapIntro": "<h3>An Open Map</h3><p>One that everyone can use and edit freely. A single place to store all geo-info. Different, small, incompatible and outdated maps are not needed anywhere.</p><p><b><a href='https://OpenStreetMap.org' target='_blank'>OpenStreetMap</a></b> is not the enemy map. The map data can be used freely (with <a href='https://osm.org/copyright' target='_blank'>attribution and publication of changes to that data</a>). Everyone can add new data and fix errors. This website uses OpenStreetMap. All the data is from there, and your answers and corrections are used all over.</p><p>Many people and apps already use OpenStreetMap: <a href='https://organicmaps.app/' target='_blank'>Organic Maps</a>, <a href='https://osmAnd.net' target='_blank'>OsmAnd</a>, but also the maps at Facebook, Instagram, Apple-maps and Bing-maps are (partly) powered by OpenStreetMap.</p>",
"openTheMap": "Open the map",
"openTheMapAtGeolocation": "Zoom to your location",
"openTheMapReason": "to view, edit and add information",
"opening_hours": {
"all_days_from": "Opened every day {ranges}",
"closed_permanently": "Closed for an unknown duration",
@ -401,9 +402,15 @@
"copiedToClipboard": "Link copied to clipboard",
"documentation": "For more information on available URL-parameters, <a href='https://github.com/pietervdvn/MapComplete/blob/develop/Docs/URL_Parameters.md' target='_blank'>consult the documentation</a>",
"embedIntro": "<h3>Embed on your website</h3>Please, embed this map into your website. <br/>We encourage you to do it - you don't even have to ask permission. <br/> It is free, and always will be. The more people are using this, the more valuable it becomes.",
"fsBackground": "Enable switching backgrounds",
"fsFilter": "Enable the possibility to toggle layers and filters",
"fsGeolocation": "Enable geolocation",
"fsUserbadge": "Enable the login button",
"fsWelcomeMessage": "Show the welcome message popup and associated tabs",
"intro": "<h3>Share this map</h3> Share this map by copying the link below and sending it to friends and family:",
"openLayers": "Open the layers and filters menu",
"options": "Sharing options",
"stateIsIncluded": "The current state of the layers and filters is included in the shared link and iframe.",
"thanksForSharing": "Thanks for sharing!",
"title": "Share this map"
},

View file

@ -51,7 +51,7 @@ export class SummaryTileSourceRewriter implements FeatureSource {
...f.properties,
id: f.properties.id + bitmap,
total: newTotal,
total_metric: Utils.numberWithMetrixPrefix(newTotal),
total_metric: Utils.numberWithMetricPrefix(newTotal),
},
})
fullTotal += newTotal
@ -101,12 +101,12 @@ export class SummaryTileSource extends DynamicTileSource {
return SummaryTileSource.empty
}
const counts = count["success"]
if (counts === undefined || counts["total"] === 0) {
const total = Number(counts?.["total"] ?? 0)
if (total === 0) {
return SummaryTileSource.empty
}
const lat = counts["lat"]
const lon = counts["lon"]
const total = Number(counts["total"])
const tileBbox = new BBox(Tiles.tile_bounds_lon_lat(z, x, y))
if (!tileBbox.contains([lon, lat])) {
console.error(
@ -128,7 +128,7 @@ export class SummaryTileSource extends DynamicTileSource {
summary: "yes",
...counts,
total,
total_metric: Utils.numberWithMetrixPrefix(total),
total_metric: Utils.numberWithMetricPrefix(total),
layers: layersSummed,
},
geometry: {

View file

@ -18,14 +18,14 @@ class FeatureSwitchUtils {
key,
"" + defaultValue,
documentation,
{ stackOffset: -1 }
{ stackOffset: -1 },
)
// It takes the current layout, extracts the default value for this query parameter. A query parameter event source is then retrieved and flattened
return queryParam.sync(
(str) => (str === undefined ? defaultValue : str !== "false"),
[],
(b) => (b == defaultValue ? undefined : "" + b)
(b) => (b == defaultValue ? undefined : "" + b),
)
}
}
@ -37,7 +37,7 @@ export class OsmConnectionFeatureSwitches {
this.featureSwitchFakeUser = QueryParameters.GetBooleanQueryParameter(
"fake-user",
false,
"If true, 'dryrun' mode is activated and a fake user account is loaded"
"If true, 'dryrun' mode is activated and a fake user account is loaded",
)
}
}
@ -99,14 +99,14 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches {
this.featureSwitchEnableLogin = FeatureSwitchUtils.initSwitch(
"fs-enable-login",
layoutToUse?.enableUserBadge ?? true,
"Disables/Enables logging in and thus disables editing all together. This effectively puts MapComplete into read-only mode."
"Disables/Enables logging in and thus disables editing all together. This effectively puts MapComplete into read-only mode.",
)
{
if (QueryParameters.wasInitialized("fs-userbadge")) {
// userbadge is the legacy name for 'enable-login'
this.featureSwitchEnableLogin.setData(
QueryParameters.GetBooleanQueryParameter("fs-userbadge", undefined, "Legacy")
.data
.data,
)
}
}
@ -114,60 +114,64 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches {
this.featureSwitchSearch = FeatureSwitchUtils.initSwitch(
"fs-search",
layoutToUse?.enableSearch ?? true,
"Disables/Enables the search bar"
"Disables/Enables the search bar",
)
this.featureSwitchBackgroundSelection = FeatureSwitchUtils.initSwitch(
"fs-background",
layoutToUse?.enableBackgroundLayerSelection ?? true,
"Disables/Enables the background layer control where a user can enable e.g. aerial imagery"
"Disables/Enables the background layer control where a user can enable e.g. aerial imagery",
)
this.featureSwitchFilter = FeatureSwitchUtils.initSwitch(
"fs-filter",
layoutToUse?.enableLayers ?? true,
"Disables/Enables the filter view where a user can enable/disable MapComplete-layers or filter for certain properties"
"Disables/Enables the filter view where a user can enable/disable MapComplete-layers or filter for certain properties",
)
this.featureSwitchWelcomeMessage = FeatureSwitchUtils.initSwitch(
"fs-welcome-message",
true,
"Disables/enables the help menu or welcome message"
"Disables/enables the help menu or welcome message",
)
this.featureSwitchCommunityIndex = FeatureSwitchUtils.initSwitch(
"fs-community-index",
this.featureSwitchEnableLogin.data,
"Disables/enables the button to get in touch with the community"
"Disables/enables the button to get in touch with the community",
)
this.featureSwitchExtraLinkEnabled = FeatureSwitchUtils.initSwitch(
"fs-iframe-popout",
true,
"Disables/Enables the extraLink button. By default, if in iframe mode and the welcome message is hidden, a popout button to the full mapcomplete instance is shown instead (unless disabled with this switch or another extraLink button is enabled)"
"Disables/Enables the extraLink button. By default, if in iframe mode and the welcome message is hidden, a popout button to the full mapcomplete instance is shown instead (unless disabled with this switch or another extraLink button is enabled)",
)
this.featureSwitchBackToThemeOverview = FeatureSwitchUtils.initSwitch(
"fs-homepage-link",
layoutToUse?.enableMoreQuests ?? true,
"Disables/Enables the various links which go back to the index page with the theme overview"
"Disables/Enables the various links which go back to the index page with the theme overview",
)
this.featureSwitchShareScreen = FeatureSwitchUtils.initSwitch(
"fs-share-screen",
layoutToUse?.enableShareScreen ?? true,
"Disables/Enables the 'Share-screen'-tab in the welcome message"
"Disables/Enables the 'Share-screen'-tab in the welcome message",
)
this.featureSwitchGeolocation = FeatureSwitchUtils.initSwitch(
"fs-geolocation",
layoutToUse?.enableGeolocation ?? true,
"Disables/Enables the geolocation button"
"Disables/Enables the geolocation button",
)
this.featureSwitchLayerDefault = QueryParameters.GetBooleanQueryParameter("fs-layers-enabled", true,
"If set to false, all layers will be disabled - except the explicitly enabled layers",
)
this.featureSwitchShowAllQuestions = FeatureSwitchUtils.initSwitch(
"fs-all-questions",
layoutToUse?.enableShowAllQuestions ?? false,
"Always show all questions"
"Always show all questions",
)
this.featureSwitchEnableExport = FeatureSwitchUtils.initSwitch(
"fs-export",
layoutToUse?.enableExportButton ?? true,
"Enable the export as GeoJSON and CSV button"
"Enable the export as GeoJSON and CSV button",
)
let testingDefaultValue = false
@ -181,63 +185,60 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches {
this.featureSwitchIsTesting = QueryParameters.GetBooleanQueryParameter(
"test",
testingDefaultValue,
"If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org"
"If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org",
)
this.featureSwitchIsDebugging = QueryParameters.GetBooleanQueryParameter(
"debug",
false,
"If true, shows some extra debugging help such as all the available tags on every object"
"If true, shows some extra debugging help such as all the available tags on every object",
)
this.featureSwitchMorePrivacy = QueryParameters.GetBooleanQueryParameter(
"moreprivacy",
layoutToUse.enableMorePrivacy,
"If true, the location distance indication will not be written to the changeset and other privacy enhancing measures might be taken."
"If true, the location distance indication will not be written to the changeset and other privacy enhancing measures might be taken.",
)
this.overpassUrl = QueryParameters.GetQueryParameter(
"overpassUrl",
(layoutToUse?.overpassUrl ?? Constants.defaultOverpassUrls).join(","),
"Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter"
"Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter",
).sync(
(param) => param?.split(","),
[],
(urls) => urls?.join(",")
(urls) => urls?.join(","),
)
this.overpassTimeout = UIEventSource.asInt(
QueryParameters.GetQueryParameter(
"overpassTimeout",
"" + layoutToUse?.overpassTimeout,
"Set a different timeout (in seconds) for queries in overpass"
)
"Set a different timeout (in seconds) for queries in overpass",
),
)
this.overpassMaxZoom = UIEventSource.asFloat(
QueryParameters.GetQueryParameter(
"overpassMaxZoom",
"" + layoutToUse?.overpassMaxZoom,
" point to switch between OSM-api and overpass"
)
" point to switch between OSM-api and overpass",
),
)
this.osmApiTileSize = UIEventSource.asInt(
QueryParameters.GetQueryParameter(
"osmApiTileSize",
"" + layoutToUse?.osmApiTileSize,
"Tilesize when the OSM-API is used to fetch data within a BBOX"
)
"Tilesize when the OSM-API is used to fetch data within a BBOX",
),
)
this.backgroundLayerId = QueryParameters.GetQueryParameter(
"background",
layoutToUse?.defaultBackgroundId,
"The id of the background layer to start with"
"The id of the background layer to start with",
)
this.featureSwitchLayerDefault = QueryParameters.GetBooleanQueryParameter("fs-layers-enabled",true,
"If set to false, all layers will be disabled - except the explicitly enabled layers"
)
}
}

View file

@ -1,42 +1,14 @@
import { Utils } from "../../Utils"
/** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */
export class ThemeMetaTagging {
public static readonly themeName = "usersettings"
public static readonly themeName = "usersettings"
public metaTaggging_for_usersettings(feat: { properties: Record<string, string> }) {
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () =>
feat.properties._description
.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)
?.at(1)
)
Utils.AddLazyProperty(
feat.properties,
"_d",
() => feat.properties._description?.replace(/&lt;/g, "<")?.replace(/&gt;/g, ">") ?? ""
)
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () =>
((feat) => {
const e = document.createElement("div")
e.innerHTML = feat.properties._d
return Array.from(e.getElementsByTagName("a")).filter(
(a) => a.href.match(/mastodon|en.osm.town/) !== null
)[0]?.href
})(feat)
)
Utils.AddLazyProperty(feat.properties, "_mastodon_link", () =>
((feat) => {
const e = document.createElement("div")
e.innerHTML = feat.properties._d
return Array.from(e.getElementsByTagName("a")).filter(
(a) => a.getAttribute("rel")?.indexOf("me") >= 0
)[0]?.href
})(feat)
)
Utils.AddLazyProperty(
feat.properties,
"_mastodon_candidate",
() => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a
)
feat.properties["__current_backgroun"] = "initial_value"
}
}
public metaTaggging_for_usersettings(feat: {properties: Record<string, string>}) {
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) )
Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/&lt;/g,'<')?.replace(/&gt;/g,'>') ?? '' )
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) )
Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) )
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a )
feat.properties['__current_backgroun'] = 'initial_value'
}
}

View file

@ -120,6 +120,11 @@ export class MenuState {
name: "community",
showOverOthers: true,
},
{
toggle: this.filtersPanelIsOpened,
name: "filters",
showOverOthers: true,
},
{
toggle: this.menuIsOpened,
name: "menu",
@ -135,11 +140,7 @@ export class MenuState {
name: "background",
showOverOthers: true,
},
{
toggle: this.filtersPanelIsOpened,
name: "filters",
showOverOthers: true,
},
]
for (const toggle of this.allToggles) {
toggle.toggle.addCallback((isOpen) => {

View file

@ -328,7 +328,7 @@ export default class PointRenderingConfig extends WithContextLoader {
?.SetClass("flex items-center justify-center absolute marker-label")
?.SetClass(cssClassesLabel)
if (cssLabel) {
label.SetStyle(cssLabel)
label?.SetStyle(cssLabel)
} else if (labelOnly) {
return label?.SetStyle("transform: translate(-50%, -50%);")
}

View file

@ -365,7 +365,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
)
this.favourites = new FavouritesFeatureSource(this)
this.featureSummary = this.setupSummaryLayer()
this.featureSummary = this.setupSummaryLayer(new LayerConfig(<LayerConfigJson> summaryLayer, "summaryLayer", true))
this.toCacheSavers = this.initSaveToLocalStorage()
this.initActors()
this.drawSpecialLayers()
@ -681,7 +681,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
)
}
private setupSummaryLayer(): SummaryTileSourceRewriter {
private setupSummaryLayer(summaryLayerConfig: LayerConfig): SummaryTileSourceRewriter {
/**
* MaxZoom for the summary layer
*/
@ -707,7 +707,9 @@ export default class ThemeViewState implements SpecialVisualizationState {
isActive: this.mapProperties.zoom.map((z) => z < maxzoom),
}
)
return new SummaryTileSourceRewriter(summaryTileSource, this.layerState.filteredLayers)
const src =new SummaryTileSourceRewriter(summaryTileSource, this.layerState.filteredLayers)
return src
}
/**
@ -793,10 +795,10 @@ export default class ThemeViewState implements SpecialVisualizationState {
selectedElement: this.selectedElement,
})
})
const summaryLayerConfig = new LayerConfig(<LayerConfigJson>summaryLayer, "summaryLayer")
new ShowDataLayer(this.map, {
features: specialLayers.summary,
layer: new LayerConfig(<LayerConfigJson>summaryLayer, "summaryLayer"),
layer: summaryLayerConfig,
// doShowLayer: this.mapProperties.zoom.map((z) => z < maxzoom),
selectedElement: this.selectedElement,
})

View file

@ -0,0 +1,59 @@
<script lang="ts">
import { Utils } from "../../Utils"
import Share from "@babeard/svelte-heroicons/solid/Share"
import { DocumentDuplicateIcon } from "@rgossiaux/svelte-heroicons/outline"
import Tr from "./Tr.svelte"
import Translations from "../i18n/Translations"
import ThemeViewState from "../../Models/ThemeViewState"
const tr = Translations.t.general.sharescreen
export let text: string
export let state: ThemeViewState = undefined
async function shareCurrentLink() {
await navigator.share({
title: Translations.W(state.layout.title)?.ConstructElement().textContent ?? "MapComplete",
text: Translations.W(state.layout.description)?.ConstructElement().textContent ?? "",
url: text,
})
}
let isCopied = false
async function copyCurrentLink() {
await navigator.clipboard.writeText(text)
isCopied = true
await Utils.waitFor(5000)
isCopied = false
}
</script>
<div class="flex flex-col">
<div class="flex">
<div class="literal-code" on:click={(e) => Utils.selectTextIn(e.target)}>
{text}
</div>
<div class="flex flex-col">
{#if typeof navigator?.share === "function" && state !== undefined}
<button class="h-8 w-8 shrink-0 p-1" on:click={shareCurrentLink}>
<Share />
</button>
{/if}
{#if navigator.clipboard !== undefined}
<button class="no-image-background h-8 w-8 shrink-0 p-1" on:click={copyCurrentLink}>
<DocumentDuplicateIcon />
</button>
{/if}
</div>
</div>
<div class="flex justify-center">
{#if isCopied}
<Tr t={tr.copiedToClipboard} cls="thanks m-2" />
{/if}
</div>
</div>

View file

@ -15,7 +15,10 @@
import ToSvelte from "../Base/ToSvelte.svelte"
import Img from "../Base/Img"
import Qr from "../../Utils/Qr"
import AccordionSingle from "../Flowbite/AccordionSingle.svelte"
import Share from "@babeard/svelte-heroicons/solid/Share"
import Constants from "../../Models/Constants"
import Copyable from "../Base/Copyable.svelte"
export let state: ThemeViewState
const tr = Translations.t.general.sharescreen
@ -24,98 +27,106 @@
let linkToShare: string = undefined
/**
* In some cases (local deploys, custom themes), we need to set the URL to `/theme.html?layout=xyz` instead of `/xyz?...`
* Note that the 'layout='-param will be included automatically
*/
let needsThemeRedirect = url.port !== "" || url.hostname.match(/^[0-9]/) || !state.layout.official
let layoutId = state.layout.id
let baseLink =
url.protocol +
"//" +
url.host +
"/" +
(needsThemeRedirect ? "theme.html?layout=" + layoutId + "&" : layoutId + "?")
`${url.protocol}//${url.host}/${needsThemeRedirect ? "theme.html" : layoutId}?`
let showWelcomeMessage = true
let enableLogin = true
$: {
let enableFilters = true
let enableBackground = true
let enableGeolocation = true
function calculateLinkToShare(
showWelcomeMessage: boolean,
enableLogin: boolean,
enableFilters: boolean,
enableBackground: boolean,
enableGeolocation: boolean) {
const layout = state.layout
let excluded = Utils.NoNull([
showWelcomeMessage ? undefined : "fs-welcome-message",
enableLogin ? undefined : "fs-enable-login",
enableFilters ? undefined : "fs-filter",
enableBackground ? undefined : "fs-background",
enableGeolocation ? undefined : "fs-geolocation",
])
linkToShare =
baseLink +
QueryParameters.GetParts(new Set(excluded))
.concat(excluded.map((k) => k + "=" + false))
.join("&")
const layerParamsWhitelist: string[] = ["fs-layers-enabled=false"]
const layerParamsBlacklist: string[] = []
for (const flayer of state.layerState.filteredLayers.values()) {
const id = flayer.layerDef.id
if (flayer.layerDef.filterIsSameAs) {
continue
}
if (id.indexOf("note_import") >= 0) {
continue
}
if (Constants.added_by_default.indexOf(<any>id) >= 0) {
continue
}
const enabled = flayer.isDisplayed.data
if (enabled) {
layerParamsWhitelist.push("layer-" + id + "=true")
} else {
layerParamsBlacklist.push("layer-" + id + "=false")
}
}
const layersBlack = layerParamsBlacklist.join("&")
const layersWhite = layerParamsWhitelist.join("&")
const layers = layersBlack.length < layersWhite.length ? layerParamsBlacklist : layerParamsWhitelist
const params = QueryParameters.GetParts(new Set(excluded))
.filter(part => !part.startsWith("layer-"))
.concat(...layers)
.concat(excluded.map((k) => k + "=" + false))
linkToShare = baseLink + Utils.Dedup(params).join("&")
if (layout.definitionRaw !== undefined) {
linkToShare += "&userlayout=" + (layout.definedAtUrl ?? layout.id)
}
}
async function shareCurrentLink() {
await navigator.share({
title: Translations.W(state.layout.title)?.ConstructElement().textContent ?? "MapComplete",
text: Translations.W(state.layout.description)?.ConstructElement().textContent ?? "",
url: linkToShare,
})
}
$: calculateLinkToShare(showWelcomeMessage, enableLogin, enableFilters, enableBackground, enableGeolocation)
let isCopied = false
let iframeCode: string
$: iframeCode = `<iframe src="${linkToShare}"
${enableGeolocation ? 'allow="geolocation"' : ""} width="100%" height="100%" style="min-width: 250px; min-height: 250px"
title="${state.layout.title?.txt ?? "MapComplete"} with MapComplete">
</iframe>`
Array.from(state.layerState.filteredLayers.values()).forEach(flayer => flayer.isDisplayed.addCallbackAndRunD(_ => {
calculateLinkToShare(showWelcomeMessage, enableLogin, enableFilters, enableBackground, enableGeolocation)
}))
async function copyCurrentLink() {
await navigator.clipboard.writeText(linkToShare)
isCopied = true
await Utils.waitFor(5000)
isCopied = false
}
</script>
<div class="flex flex-col">
<div class="flex items-start justify-between">
<div class="flex flex-col">
<Tr t={tr.intro} />
<div class="flex">
{#if typeof navigator?.share === "function"}
<button class="h-8 w-8 shrink-0 p-1" on:click={shareCurrentLink}>
<Share />
</button>
{/if}
{#if navigator.clipboard !== undefined}
<button class="no-image-background h-8 w-8 shrink-0 p-1" on:click={copyCurrentLink}>
<DocumentDuplicateIcon />
</button>
{/if}
<div class="literal-code" on:click={(e) => Utils.selectTextIn(e.target)}>
{linkToShare}
</div>
</div>
</div>
<div class="flex flex-col">
<Tr t={tr.intro} />
<Copyable {state} text={linkToShare}/>
</div>
<div class="flex justify-center">
<ToSvelte
construct={() => new Img(new Qr(linkToShare).toImageElement(125)).SetStyle("width: 125px")}
/>
</div>
<div class="flex justify-center">
{#if isCopied}
<Tr t={tr.copiedToClipboard} cls="thanks m-2" />
{/if}
</div>
<Tr t={tr.embedIntro} />
<div class="interactive flex flex-col p-1">
<div class="literal-code m-1">
&lt;span class="literal-code iframe-code-block"&gt; <br />
&lt;iframe src="{linkToShare}"
<br />
allow="geolocation" width="100%" height="100%" style="min-width: 250px; min-height: 250px"
<br />
title="{state.layout.title?.txt ?? "MapComplete"} with MapComplete"&gt;
<br />
&lt;/iframe&gt;
<br />
&lt;/span&gt;
<Copyable text={iframeCode}/>
<AccordionSingle>
<div slot="header">
<Tr t={tr.options}/>
</div>
<div class="link-underline my-1 flex flex-col">
<label>
@ -127,7 +138,34 @@
<input bind:checked={enableLogin} type="checkbox" id="share_enable_login" />
<Tr t={tr.fsUserbadge} />
</label>
<label>
<input bind:checked={enableFilters} type="checkbox" id="share_enable_filter" />
<Tr t={tr.fsFilter} />
</label>
<label>
<input bind:checked={enableBackground} type="checkbox" id="share_enable_background" />
<Tr t={tr.fsBackground} />
</label>
<label>
<input bind:checked={enableGeolocation} type="checkbox" id="share_enable_geolocation" />
<Tr t={tr.fsGeolocation} />
</label>
<span>
<Tr t={tr.stateIsIncluded}/>
<a class="inline-block w-fit cursor-pointer" on:click={() => state.guistate.filtersPanelIsOpened.set(true)}>
<Tr t={tr.openLayers}/>
</a>
</span>
<Tr cls="link-underline" t={tr.documentation} />
</div>
</div>
<Tr cls="link-underline" t={tr.documentation} />
</AccordionSingle>
</div>

View file

@ -63,8 +63,13 @@
<!-- Buttons: open map, go to location, search -->
<NextButton clss="primary w-full" on:click={() => state.guistate.themeIsOpened.setData(false)}>
<div class="flex w-full justify-center text-2xl">
<Tr t={Translations.t.general.openTheMap} />
<div class="flex flex-col w-full items-center">
<div class="flex w-full justify-center text-2xl">
<Tr t={Translations.t.general.openTheMap} />
</div>
<If condition={state.featureSwitches.featureSwitchEnableLogin}>
<Tr t={Translations.t.general.openTheMapReason} />
</If>
</div>
</NextButton>

View file

@ -100,15 +100,21 @@
})
let selectedLayer: Store<LayerConfig> = state.selectedElement.mapD((element) => {
if (element.properties.id.startsWith("current_view")) {
const id = element.properties.id
if (id.startsWith("current_view")) {
return currentViewLayer
}
if (element.properties.id.startsWith(LastClickFeatureSource.newPointElementId)) {
if(id.startsWith("summary_")){
console.log("Not selecting a summary object. The summary object is", element)
return undefined
}
if (id.startsWith(LastClickFeatureSource.newPointElementId)) {
return layout.layers.find((l) => l.id === "last_click")
}
if (element.properties.id === "location_track") {
if (id === "location_track") {
return layout.layers.find((l) => l.id === "gps_track")
}
return state.layout.getMatchingLayer(element.properties)
})
let currentZoom = state.mapProperties.zoom

View file

@ -1643,7 +1643,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
*
* Supported metric prefixes are: [k, M, G, T, P, E]
*/
public static numberWithMetrixPrefix(n: number) {
public static numberWithMetricPrefix(n: number) {
let index = 0
while (n > 1000) {
n = Math.round(n / 1000)

View file

@ -1,12 +1 @@
{
"sections": [
"# How to work with TagRenderings\n\nThe information box shows various attributes of the selected feature in a human friendly way.\n\nThis is done by a **tagRendering** which converts attributes into text.\n\nThis can be done by using **predefined options** (mappings) or with a **render**-string\n",
"# Predefined options\n\nA predefined option states that, `if` a certain tag is present, `then` a certain text should be shown.\n\nFor example, a playground may be lit or not.\nIn OpenStreetMap, this is encoded with the tag `lit=yes` or `lit=no`. We might want to show `This playground is lit at night` and `This playground is not lit at night` to users of MapComplete.\n\nThis is what this will look like in the interface:\n\n<img class=\"w-1/2\" src=\"./assets/docs/PredefinedOption.png\"/>\n",
"# Substituting attributes\n\nIf none of the predefined options match, the string given in the `render`-field is used (under the question _\"What text should be rendered?\"_).\n\nA special property about all shown texts is that, **if the name of a key appears between braces, this will be replaced by the corresponding value**.\n\nFor example, if the object has tags `min_age=3` and the text to display is `Accessible to kids older than {min_age} years`, then this will be displayed to the user as **Accessible to kids older than 3 years**\n\nNote that this also works withing predifined options\n",
"# Special values\n\nSpecial components can be summoned by calling them. For example, the relevant wikipedia will be displayed by entering the text `{wikipedia()}`. A table with opening hours is displayed with `{opening_hours()}`. For a full reference, [see the documentation](https://github.com/pietervdvn/MapComplete/blob/master/Docs/SpecialRenderings.md).\n",
"# Requesting data with predefined options\n\nThese renderings can be turned into a way to contribute data easily. If a **question** is provided, then these renderings will be asked if unknown or gain the pencil to make changes. \n\nA predefined option will show up as an option that can be picked.\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionPredefinedOptions.png\"/>\n",
"# Requesting data with an input field\n\nIt is also possible to have a text field. For this, the **key** to write into must be given (_What is the name of the attribute that should be written to?_), in this case `max_age`.\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionTextField.png\"/>\n",
"# Combining predefined options and freeform text\n\nA text field and predefined options can be combined. The contributor can then choose between a predefined option or filling out something.\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionCombined.png\"/>\n",
"# Selecting multiple values\n\nOne can set a question to allow multiple answers. This works with predefined options or a freeform text field.\n\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionMulti.png\"/>\n\nNote that these will be rendered as a list:\n\n<img class=\"w-1/2\" src=\"./assets/docs/RenderMulti.png\"/>\n"
]
}
{"sections":["# How to work with TagRenderings\n\nThe information box shows various attributes of the selected feature in a human friendly way.\n\nThis is done by a **tagRendering** which converts attributes into text.\n\nThis can be done by using **predefined options** (mappings) or with a **render**-string\n","# Predefined options\n\nA predefined option states that, `if` a certain tag is present, `then` a certain text should be shown.\n\nFor example, a playground may be lit or not.\nIn OpenStreetMap, this is encoded with the tag `lit=yes` or `lit=no`. We might want to show `This playground is lit at night` and `This playground is not lit at night` to users of MapComplete.\n\nThis is what this will look like in the interface:\n\n<img class=\"h-fit\" src=\"./assets/docs/PredefinedOption.png\"/>\n","# Substituting attributes\n\nIf none of the predefined options match, the string given in the `render`-field is used (under the question _\"What text should be rendered?\"_).\n\nA special property about all shown texts is that, **if the name of a key appears between braces, this will be replaced by the corresponding value**.\n\nFor example, if the object has tags `min_age=3` and the text to display is `Accessible to kids older than {min_age} years`, then this will be displayed to the user as **Accessible to kids older than 3 years**\n\nNote that this also works withing predifined options\n","# Special values\n\nSpecial components can be summoned by calling them. For example, the relevant wikipedia will be displayed by entering the text `{wikipedia()}`. A table with opening hours is displayed with `{opening_hours()}`. For a full reference, [see the documentation](https://github.com/pietervdvn/MapComplete/blob/master/Docs/SpecialRenderings.md).\n","# Requesting data with predefined options\n\nThese renderings can be turned into a way to contribute data easily. If a **question** is provided, then these renderings will be asked if unknown or gain the pencil to make changes. \n\nA predefined option will show up as an option that can be picked.\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionPredefinedOptions.png\"/>\n","# Requesting data with an input field\n\nIt is also possible to have a text field. For this, the **key** to write into must be given (_What is the name of the attribute that should be written to?_), in this case `max_age`.\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionTextField.png\"/>\n","# Combining predefined options and freeform text\n\nA text field and predefined options can be combined. The contributor can then choose between a predefined option or filling out something.\n<img class=\"w-1/2\" src=\"./assets/docs/QuestionCombined.png\"/>\n","# Selecting multiple values\n\nOne can set a question to allow multiple answers. This works with predefined options or a freeform text field.\n\n<img class=\"w-1/2 h-fit\" src=\"./assets/docs/QuestionMulti.png\"/>\n\nNote that these will be rendered as a list:\n\n<img class=\"w-1/2 h-fit\" src=\"./assets/docs/RenderMulti.png\"/>\n"]}