Add more bicycle options to cycle rental; add deletion and images to cycle rental, fix #703

This commit is contained in:
pietervdvn 2022-03-14 20:45:17 +01:00
parent 2d356476df
commit b406d17b10
12 changed files with 182 additions and 114 deletions

View file

@ -366,29 +366,34 @@ export default class TagRenderingConfig {
// A flag to check that the freeform key isn't matched multiple times
// If it is undefined, it is "used" already, or at least we don't have to check for it anymore
let freeformKeyUsed = this.freeform?.key === undefined;
let freeformKeyDefined = this.freeform?.key !== undefined;
let usedFreeformValues = new Set<string>()
// We run over all the mappings first, to check if the mapping matches
const applicableMappings: { then: Translation, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => {
if (mapping.if === undefined) {
return mapping;
}
if (TagUtils.MatchesMultiAnswer(mapping.if, tags)) {
if (!freeformKeyUsed) {
if (mapping.if.usedKeys().indexOf(this.freeform.key) >= 0) {
// This mapping matches the freeform key - we mark the freeform key to be ignored!
freeformKeyUsed = true;
}
if (freeformKeyDefined && mapping.if.isUsableAsAnswer()) {
// THe freeform key is defined: what value does it use though?
// We mark the value to see if we have any leftovers
const value = mapping.if.asChange({}).find(kv => kv.k === this.freeform.key).v
usedFreeformValues.add(value)
}
return mapping;
}
return undefined;
}))
if (!freeformKeyUsed
&& tags[this.freeform.key] !== undefined) {
applicableMappings.push({then: this.render})
if(freeformKeyDefined && tags[this.freeform.key] !== undefined){
const freeformValues = tags[this.freeform.key].split(";")
const leftovers = freeformValues.filter(v => !usedFreeformValues.has(v))
for (const leftover of leftovers) {
applicableMappings.push({then: this.render.OnEveryLanguage(str =>
str.replace(new RegExp("{"+this.freeform.key+"}", "g"), leftover))})
}
}
return applicableMappings
}

View file

@ -456,7 +456,7 @@ export default class TagRenderingQuestion extends Combine {
if (freeform.inline) {
inputTagsFilter.SetClass("w-16-imp")
inputTagsFilter.SetClass("w-48-imp")
inputTagsFilter = new InputElementWrapper(inputTagsFilter, configuration.render, freeform.key, tags, state)
inputTagsFilter.SetClass("block")

View file

@ -146,10 +146,11 @@
},
"render": {
"en": "{rental} is rented here",
"nl": "{rental} wordt hier uitgeleend"
"nl": "{rental} kunnen hier uitgeleend worden"
},
"freeform": {
"key": "rental"
"key": "rental",
"inline": true
},
"multiAnswer": true,
"mappings": [
@ -194,6 +195,13 @@
"en": "Tandem bicycles can be rented here",
"nl": "Tandems kunnen hier gehuurd worden"
}
},
{
"if": "rental=racebike",
"then": {
"en": "Race bicycles can be rented here",
"nl": "Wielerfietsen (sportfietsen) kunnen hier gehuurd worden"
}
}
]
},
@ -222,7 +230,7 @@
"kid_bike",
{
"en": "bikes for children",
"nl": "Kinderfietsen"
"nl": "kinderfietsen"
}
],
[
@ -249,7 +257,7 @@
[
"tandem_bicycle",
{
"en": "tandem bicycle",
"en": "tandem",
"nl": "tandem"
}
]
@ -320,5 +328,33 @@
"render": "2"
}
}
]
],
"allowMove": {
"enableImproveAccuracy": true,
"enableRelocation": true
},
"deletion": {
"softDeletionTags": {
"and": ["disused:amenity=bicycle_rental", "bicycle_rental=", "rental="]
},
"neededChangesets": 10,
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}],
"nonDeleteMappings": [{
"if": {
"and": [
"service:bicycle:rental=no"
]
},
"then": {
"en": "This bicycle shop used to rent out bikes but doesn't rent out bikes anymore",
"nl": "Deze fietszaak verhuurde vroeger fietsen, maar nu niet meer"
}
}]
}
}

View file

@ -199,7 +199,14 @@
"amenity=",
"disused:amenity:={amenity}"
]
}
},
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}]
},
"allowMove": true,
"mapRendering": [

View file

@ -671,7 +671,14 @@
"amenity=",
"disused:amenity:={amenity}"
]
}
},
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}]
},
"allowMove": true,
"mapRendering": [

View file

@ -356,7 +356,14 @@
"amenity=",
"disused:amenity:={amenity}"
]
}
},
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}]
},
"allowMove": true,
"mapRendering": [

View file

@ -1,16 +1,13 @@
{
"id": "mapcomplete-changes",
"title": {
"en": "Changes made with MapComplete",
"de": "Änderungen mit MapComplete"
"en": "Changes made with MapComplete"
},
"shortDescription": {
"en": "Shows changes made by MapComplete",
"de": "Zeigt Änderungen, die von MapComplete vorgenommen wurden"
"en": "Shows changes made by MapComplete"
},
"description": {
"en": "This maps shows all the changes made with MapComplete",
"de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen"
"en": "This maps shows all the changes made with MapComplete"
},
"maintainer": "",
"icon": "./assets/svg/logo.svg",
@ -25,8 +22,7 @@
{
"id": "mapcomplete-changes",
"name": {
"en": "Changeset centers",
"de": "Schwerpunkte von Änderungssätzen"
"en": "Changeset centers"
},
"minzoom": 0,
"source": {
@ -40,41 +36,35 @@
],
"title": {
"render": {
"en": "Changeset for {theme}",
"de": "Änderungssatz für {theme}"
"en": "Changeset for {theme}"
}
},
"description": {
"en": "Shows all MapComplete changes",
"de": "Zeigt alle MapComplete-Änderungen"
"en": "Shows all MapComplete changes"
},
"tagRenderings": [
{
"id": "render_id",
"render": {
"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>"
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
}
},
{
"id": "contributor",
"render": {
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>",
"de": "Geändert von <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
}
},
{
"id": "theme",
"render": {
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
"de": "Änderung mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
},
"mappings": [
{
"if": "theme~http.*",
"then": {
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>",
"de": "Änderung mit <b>inoffiziellem</b> Thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
}
}
]
@ -338,8 +328,7 @@
}
],
"question": {
"en": "Themename contains {search}",
"de": "Themenname enthält {search}"
"en": "Themename contains {search}"
}
}
]
@ -355,8 +344,7 @@
}
],
"question": {
"en": "Made by contributor {search}",
"de": "Erstellt von Mitwirkendem {search}"
"en": "Made by contributor {search}"
}
}
]
@ -372,8 +360,7 @@
}
],
"question": {
"en": "<b>Not</b> made by contributor {search}",
"de": "<b> Nicht</b> erstellt von Mitwirkendem {search}"
"en": "<b>Not</b> made by contributor {search}"
}
}
]
@ -388,8 +375,7 @@
{
"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>",
"de": "Weitere Statistiken finden Sie <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
}
},
{

View file

@ -1985,6 +1985,14 @@ a {
width: 4rem !important;
}
.w-32-imp {
width: 8rem !important;
}
.w-48-imp {
width: 12rem !important;
}
.link-underline a {
-webkit-text-decoration: underline 1px var(--foreground-color);
text-decoration: underline 1px var(--foreground-color);

View file

@ -223,6 +223,14 @@ a {
width: 4rem !important;
}
.w-32-imp {
width: 8rem !important;
}
.w-48-imp {
width: 12rem !important;
}
.link-underline a {
text-decoration: underline 1px var(--foreground-color);
}

View file

@ -418,6 +418,18 @@
}
},
"bicycle_rental": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
},
"nonDeleteMappings": {
"0": {
"then": "This bicycle shop used to rent out bikes but doesn't rent out bikes anymore"
}
}
},
"description": "Bicycle rental stations",
"name": "Bicycle rental",
"presets": {
@ -458,7 +470,7 @@
"1": "bicycle panniers"
},
"6": {
"1": "tandem bicycle"
"1": "tandem"
}
}
}
@ -1215,6 +1227,13 @@
}
},
"cafe_pub": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
}
},
"description": "A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions",
"filter": {
"0": {
@ -3149,6 +3168,13 @@
}
},
"food": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
}
},
"description": "A layer showing restaurants and fast-food amenities (with a special rendering for friteries)",
"filter": {
"0": {
@ -4346,6 +4372,13 @@
}
},
"shops": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
}
},
"description": "A shop",
"name": "Shop",
"presets": {

View file

@ -418,6 +418,18 @@
}
},
"bicycle_rental": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
},
"nonDeleteMappings": {
"0": {
"then": "Deze fietszaak verhuurde vroeger fietsen, maar nu niet meer"
}
}
},
"description": "Fietsverhuustations",
"name": "Fietsverhuur",
"presets": {
@ -446,7 +458,7 @@
"1": "elektrische fietsen"
},
"2": {
"1": "Kinderfietsen"
"1": "kinderfietsen"
},
"3": {
"1": "BMX-fietsen"
@ -484,8 +496,8 @@
"then": "Tandems kunnen hier gehuurd worden"
}
},
"question": "Wat voor soort fietsen en fietstoebehoren worden hier verhuurd?",
"render": "{rental} wordt hier uitgeleend"
"question": "Wat voor soort fietsen en fietstoebehren worden hier verhuurd?",
"render": "{rental} kunnen hier uitgeleend worden"
},
"bicycle_rental_type": {
"mappings": {
@ -1224,6 +1236,13 @@
}
},
"cafe_pub": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
}
},
"description": "Een laag die kroegen en koffiehuizen toont waar je iets kunt drinken. De laag zal je enkele vragen stellen",
"filter": {
"0": {
@ -3101,6 +3120,13 @@
}
},
"food": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
}
},
"filter": {
"0": {
"options": {
@ -4169,6 +4195,13 @@
}
},
"shops": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
}
},
"description": "Een winkel",
"name": "Winkel",
"presets": {
@ -5237,4 +5270,4 @@
"render": "Watermolens"
}
}
}
}

View file

@ -968,68 +968,6 @@
"shortDescription": "Hydranten, Feuerlöscher, Feuerwachen und Rettungswachen.",
"title": "Hydranten, Feuerlöscher, Feuerwachen und Rettungswachen."
},
"mapcomplete-changes": {
"description": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen",
"layers": {
"0": {
"description": "Zeigt alle MapComplete-Änderungen",
"filter": {
"0": {
"options": {
"0": {
"question": "Themenname enthält {search}"
}
}
},
"1": {
"options": {
"0": {
"question": "Erstellt von Mitwirkendem {search}"
}
}
},
"2": {
"options": {
"0": {
"question": "<b> Nicht</b> erstellt von Mitwirkendem {search}"
}
}
}
},
"name": "Schwerpunkte von Änderungssätzen",
"tagRenderings": {
"contributor": {
"render": "Geändert von <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
},
"render_id": {
"render": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
},
"theme": {
"mappings": {
"0": {
"then": "Änderung mit <b>inoffiziellem</b> Thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
}
},
"render": "Änderung mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
}
},
"title": {
"render": "Änderungssatz für {theme}"
}
},
"1": {
"override": {
"tagRenderings": {
"link_to_more": {
"render": "Weitere Statistiken finden Sie <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
}
}
}
}
},
"shortDescription": "Zeigt Änderungen, die von MapComplete vorgenommen wurden",
"title": "Änderungen mit MapComplete"
},
"maps": {
"description": "Auf dieser Karte findest du alle Karten, die OpenStreetMap kennt - typischerweise eine große Karte auf einer Informationstafel, die das Gebiet, die Stadt oder die Region zeigt, z.B. eine touristische Karte auf der Rückseite einer Plakatwand, eine Karte eines Naturschutzgebietes, eine Karte der Radwegenetze in der Region, ...) <br/><br/>Wenn eine Karte fehlt, können Sie diese leicht auf OpenStreetMap kartieren.",
"shortDescription": "Dieses Thema zeigt alle (touristischen) Karten, die OpenStreetMap kennt",