diff --git a/Docs/URL_Parameters.md b/Docs/URL_Parameters.md index 3021da1661..5dc4dbf5b6 100644 --- a/Docs/URL_Parameters.md +++ b/Docs/URL_Parameters.md @@ -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--) +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--) 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_ diff --git a/assets/layers/questions/questions.json b/assets/layers/questions/questions.json index cf63918738..30febaed08 100644 --- a/assets/layers/questions/questions.json +++ b/assets/layers/questions/questions.json @@ -2743,6 +2743,7 @@ "_last_edit:passed_time>=300" ] }, + "metacondition": "__featureSwitchEnableLogin=true", "render": { "special": { "type": "if_nothing_known", diff --git a/assets/layers/summary/summary.json b/assets/layers/summary/summary.json index 8c9956724b..31dfcab044 100644 --- a/assets/layers/summary/summary.json +++ b/assets/layers/summary/summary.json @@ -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" } diff --git a/assets/themes/cyclofix/cyclofix.json b/assets/themes/cyclofix/cyclofix.json index 9d7275fa64..da585e25d0 100644 --- a/assets/themes/cyclofix/cyclofix.json +++ b/assets/themes/cyclofix/cyclofix.json @@ -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 } } ], diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 71a45eb7f8..609aa246ac 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -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 {id}" + "en": "Changeset {id}", + "de": "Änderungssatz {id}" } }, { "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 {user}" + "en": "Change made by {user}", + "da": "Ændring lavet af {user}", + "de": "Änderung vorgenommen von {user}" } }, { "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 {theme}" + "en": "Change with theme {theme}", + "de": "Geändert mit Thema {theme}" } }, { @@ -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 {host}" + "en": "Change with with {host}", + "de": "Änderung über {host}" }, "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 not contain {search}" + "en": "Themename does not contain {search}", + "da": "Temanavn indeholder ikke {search}", + "de": "Themename enthält not {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": "Not made by contributor {search}" + "en": "Not made by contributor {search}", + "da": "Ikke lavet af bidragsyder {search}", + "de": "Nicht 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 here" + "en": "More statistics can be found here", + "de": "Weitere Statistiken gibt es hier" } }, { diff --git a/langs/de.json b/langs/de.json index b4661ce407..c5985b044d 100644 --- a/langs/de.json +++ b/langs/de.json @@ -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 {source} unter Verwendung des eingebetteten JSON-LD geladen", "missing": { "intro": "OpenStreetMap hat keine Informationen über die folgenden Attribute", diff --git a/langs/en.json b/langs/en.json index 15b4df93de..89e46c9d2f 100644 --- a/langs/en.json +++ b/langs/en.json @@ -322,6 +322,7 @@ "openStreetMapIntro": "

An Open Map

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.

OpenStreetMap is not the enemy map. The map data can be used freely (with attribution and publication of changes to that data). 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.

Many people and apps already use OpenStreetMap: Organic Maps, OsmAnd, but also the maps at Facebook, Instagram, Apple-maps and Bing-maps are (partly) powered by OpenStreetMap.

", "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, consult the documentation", "embedIntro": "

Embed on your website

Please, embed this map into your website.
We encourage you to do it - you don't even have to ask permission.
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": "

Share this map

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" }, diff --git a/src/Logic/FeatureSource/TiledFeatureSource/SummaryTileSource.ts b/src/Logic/FeatureSource/TiledFeatureSource/SummaryTileSource.ts index 81faaa2897..0fd5e3ea09 100644 --- a/src/Logic/FeatureSource/TiledFeatureSource/SummaryTileSource.ts +++ b/src/Logic/FeatureSource/TiledFeatureSource/SummaryTileSource.ts @@ -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: { diff --git a/src/Logic/State/FeatureSwitchState.ts b/src/Logic/State/FeatureSwitchState.ts index b4030ce1f5..0eedc2576c 100644 --- a/src/Logic/State/FeatureSwitchState.ts +++ b/src/Logic/State/FeatureSwitchState.ts @@ -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" - ) } } diff --git a/src/Logic/State/UserSettingsMetaTagging.ts b/src/Logic/State/UserSettingsMetaTagging.ts index 6e568c5c32..33a5ae85b5 100644 --- a/src/Logic/State/UserSettingsMetaTagging.ts +++ b/src/Logic/State/UserSettingsMetaTagging.ts @@ -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 }) { - 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(/</g, "<")?.replace(/>/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}) { + 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(/</g,'<')?.replace(/>/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' + } +} \ No newline at end of file diff --git a/src/Models/MenuState.ts b/src/Models/MenuState.ts index b40926d6a4..64b0084f77 100644 --- a/src/Models/MenuState.ts +++ b/src/Models/MenuState.ts @@ -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) => { diff --git a/src/Models/ThemeConfig/PointRenderingConfig.ts b/src/Models/ThemeConfig/PointRenderingConfig.ts index f7fddf1640..4320f3c738 100644 --- a/src/Models/ThemeConfig/PointRenderingConfig.ts +++ b/src/Models/ThemeConfig/PointRenderingConfig.ts @@ -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%);") } diff --git a/src/Models/ThemeViewState.ts b/src/Models/ThemeViewState.ts index d842016b80..e58afda1ec 100644 --- a/src/Models/ThemeViewState.ts +++ b/src/Models/ThemeViewState.ts @@ -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( 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(summaryLayer, "summaryLayer") new ShowDataLayer(this.map, { features: specialLayers.summary, - layer: new LayerConfig(summaryLayer, "summaryLayer"), + layer: summaryLayerConfig, // doShowLayer: this.mapProperties.zoom.map((z) => z < maxzoom), selectedElement: this.selectedElement, }) diff --git a/src/UI/Base/Copyable.svelte b/src/UI/Base/Copyable.svelte new file mode 100644 index 0000000000..e39ba28c8c --- /dev/null +++ b/src/UI/Base/Copyable.svelte @@ -0,0 +1,59 @@ + + +
+ +
+
Utils.selectTextIn(e.target)}> + {text} +
+
+ {#if typeof navigator?.share === "function" && state !== undefined} + + {/if} + {#if navigator.clipboard !== undefined} + + {/if} +
+ + +
+ + +
+ {#if isCopied} + + {/if} +
+
diff --git a/src/UI/BigComponents/ShareScreen.svelte b/src/UI/BigComponents/ShareScreen.svelte index 4712c9fd47..943a3aedbf 100644 --- a/src/UI/BigComponents/ShareScreen.svelte +++ b/src/UI/BigComponents/ShareScreen.svelte @@ -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(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 = `` + + 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 - }
-
-
- -
- {#if typeof navigator?.share === "function"} - - {/if} - {#if navigator.clipboard !== undefined} - - {/if} -
Utils.selectTextIn(e.target)}> - {linkToShare} -
-
-
+
+ + + + + +
+
new Img(new Qr(linkToShare).toImageElement(125)).SetStyle("width: 125px")} />
-
- {#if isCopied} - - {/if} -
- -
-
- <span class="literal-code iframe-code-block">
- <iframe src="{linkToShare}" -
- allow="geolocation" width="100%" height="100%" style="min-width: 250px; min-height: 250px" -
- title="{state.layout.title?.txt ?? "MapComplete"} with MapComplete"> -
- </iframe> -
- </span> + + + +
+
-
- +
diff --git a/src/UI/BigComponents/ThemeIntroPanel.svelte b/src/UI/BigComponents/ThemeIntroPanel.svelte index 71c60d3f30..11bca9eb3c 100644 --- a/src/UI/BigComponents/ThemeIntroPanel.svelte +++ b/src/UI/BigComponents/ThemeIntroPanel.svelte @@ -63,8 +63,13 @@ state.guistate.themeIsOpened.setData(false)}> -
- +
+
+ +
+ + +
diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte index 52ae80932a..e339537d51 100644 --- a/src/UI/ThemeViewGUI.svelte +++ b/src/UI/ThemeViewGUI.svelte @@ -100,15 +100,21 @@ }) let selectedLayer: Store = 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 diff --git a/src/Utils.ts b/src/Utils.ts index 14318fceec..05e669acf9 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -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) diff --git a/src/assets/studio_tagrenderings_intro.json b/src/assets/studio_tagrenderings_intro.json index 1c7fb7da0f..f190a0102b 100644 --- a/src/assets/studio_tagrenderings_intro.json +++ b/src/assets/studio_tagrenderings_intro.json @@ -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\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\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\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\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\n\nNote that these will be rendered as a list:\n\n\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\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\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\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\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\n\nNote that these will be rendered as a list:\n\n\n"]} \ No newline at end of file