From 92c5e5dea20544e9199138d1785109d4f8f47c8e Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 5 Mar 2023 23:44:28 +0100 Subject: [PATCH] Add some useful filters --- Models/ThemeConfig/Json/FilterConfigJson.ts | 22 ++++++++ assets/layers/sport_pitch/sport_pitch.json | 59 ++++++++++++++++++++- assets/themes/grb/grb.json | 13 ++++- 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/Models/ThemeConfig/Json/FilterConfigJson.ts b/Models/ThemeConfig/Json/FilterConfigJson.ts index dda710b14..8ce944811 100644 --- a/Models/ThemeConfig/Json/FilterConfigJson.ts +++ b/Models/ThemeConfig/Json/FilterConfigJson.ts @@ -10,6 +10,28 @@ export default interface FilterConfigJson { * If there are multiple options these will be a list of radio buttons * If there is only one option this will be a checkbox * Filtering is done based on the given osmTags that are compared to the objects in that layer. + * + * An example which searches by name: + * + * ``` + * { + * "id": "shop-name", + * "options": [ + * { + * "fields": [ + * { + * "name": "search", + * "type": "string" + * } + * ], + * "osmTags": "name~i~.*{search}.*", + * "question": { + * "en": "Only show shops with name {search}", + * } + * } + * ] + * } + * ``` */ options: { question: string | any diff --git a/assets/layers/sport_pitch/sport_pitch.json b/assets/layers/sport_pitch/sport_pitch.json index 33c3bb647..7a504eedd 100644 --- a/assets/layers/sport_pitch/sport_pitch.json +++ b/assets/layers/sport_pitch/sport_pitch.json @@ -605,6 +605,63 @@ } ], "filter": [ + { + "id": "accessibility", + "options": [ + { + "question": { + "en": "Publicly accessible", + "nl": "Publiek toegankelijk" + }, + "osmTags": { + "or": [ + "access=yes", + "access=public", + "access=" + ] + } + } + ] + }, + { + "id": "available_sports", + "options": [ + { + "question": { + "en": "All sports", + "nl": "Alle sporten" + } + }, + { + "osmTags": "sport=basketball", + "question": { + "nl": "Basketbalvelden", + "en": "Basketball fields" + } + }, + { + "osmTags": "sport=soccer", + "question": { + "nl": "Voetbalvelden", + "en": "Soccer fields" + } + }, + { + "osmTags": "sport=table_tennis", + "question": { + "nl": "Pingpong-tafel", + "en": "Ping-pong table" + } + }, + { + "osmTags": "sport=tennis", + "question": { + "nl": "Tennisveld", + "en": "Tennis field" + } + } + ] + }, "open_now" ] -} \ No newline at end of file +} diff --git a/assets/themes/grb/grb.json b/assets/themes/grb/grb.json index a7f76c026..6d0cdc4d4 100644 --- a/assets/themes/grb/grb.json +++ b/assets/themes/grb/grb.json @@ -262,6 +262,17 @@ "question": "Heeft een FIXME" } ] + },{ + "id": "last-edited-by", + "options": [ + { + "fields": [{ + "name": "username" + }], + "question": "Last change made by {username}", + "osmTags": "_last_edit:contributor~i~{username}" + } + ] } ] }, @@ -757,4 +768,4 @@ "overpassMaxZoom": 17, "osmApiTileSize": 17, "credits": "Pieter Vander Vennet" -} \ No newline at end of file +}