Improvements to notes layer and elements

This commit is contained in:
Pieter Vander Vennet 2022-03-13 02:46:42 +01:00
parent 9008e333ac
commit d7df6a7a80
14 changed files with 185 additions and 38 deletions

View file

@ -25,11 +25,13 @@
]
},
"calculatedTags": [
"_total_comments:=feat.get('comments').length",
"_first_comment:=feat.get('comments')[0].text.toLowerCase()",
"_opened_by_anonymous_user:=feat.get('comments')[0].user === undefined",
"_first_user:=feat.get('comments')[0].user",
"_first_user_lc:=feat.get('comments')[0].user?.toLowerCase()",
"_first_user_id:=feat.get('comments')[0].uid",
"_last_user_lc:=(() => {const comms = feat.get('comments'); return comms[comms.length - 1].user?.toLowerCase()})()",
"_is_import_note:=(() => {const lines = feat.properties['_first_comment'].split('\\n'); const matchesMapCompleteURL = lines.map(l => l.match(\".*https://mapcomplete.osm.be/\\([a-zA-Z_-]+\\)\\(.html\\).*#import\")); const matchedIndexes = matchesMapCompleteURL.map((doesMatch, i) => [doesMatch !== null, i]).filter(v => v[0]).map(v => v[1]); return matchedIndexes[0] })()"
],
"titleIcons": [
@ -79,7 +81,13 @@
}
]
},
"iconSize": "40,40,bottom"
"iconSize": "40,40,bottom",
"iconBadges": [
{
"if": "_total_comments>1",
"then": "speech_bubble"
}
]
}
],
"filter": [
@ -147,6 +155,38 @@
}
]
},
{
"id": "edited_by",
"options": [
{
"osmTags": "_lastt_user_lc~.*{search}.*",
"fields": [
{
"name": "search"
}
],
"question": {
"en": "Opened before {search}"
}
}
]
},
{
"id": "not_edited_by",
"options": [
{
"osmTags": "_last_user_lc!~.*{search}.*",
"fields": [
{
"name": "search"
}
],
"question": {
"en": "Opened after {search}"
}
}
]
},
{
"id": "opened_before",
"options": [
@ -159,7 +199,7 @@
}
],
"question": {
"en": "Opened before {search}"
"en": "Opened by anonymous user"
}
}
]
@ -176,7 +216,7 @@
}
],
"question": {
"en": "Opened after {search}"
"en": "Only show open notes"
}
}
]
@ -187,7 +227,7 @@
{
"osmTags": "_opened_by_anonymous_user=true",
"question": {
"en": "Opened by anonymous user"
"en": "Hide import notes"
}
}
]