Show buttons for adding tags and importing

This commit is contained in:
Robin van der Linde 2022-07-18 16:08:41 +02:00
parent 512282772a
commit 63bb1a4da3
No known key found for this signature in database
GPG key ID: 53956B3252478F0D
2 changed files with 19 additions and 0 deletions

View file

@ -42,6 +42,13 @@ export default class TagApplyButton implements AutoAction {
public static generateTagsToApply(spec: string, tagSource: Store<any>): Store<Tag[]> {
// Check whether we need to look up a single value
if (!spec.includes(";") && !spec.includes("=") && spec.includes("$")){
// We seem to be dealing with a single value, fetch it
spec = tagSource.data[spec.replace("$","")]
}
const tgsSpec = spec.split(";").map(spec => {
const kv = spec.split("=").map(s => s.trim());
if (kv.length != 2) {

View file

@ -39,6 +39,18 @@
"_closest_osm_hotel=feat.closest('hotel')?.properties?.id",
"_closest_osm_hotel_distance=feat.distanceTo(feat.properties._closest_osm_hotel)",
"_has_closeby_feature=Number(feat.properties._closest_osm_hotel_distance) < 50 ? 'yes' : 'no'"
],
"+tagRenderings": [
{
"id": "import-button",
"condition": "_has_closeby_feature=no",
"render": "{import_button(hotel,tags,Import,./assets/svg/addSmall.svg,,,,photo,mr_taskId)}"
},
{
"id": "tag-apply-button",
"condition": "_has_closeby_feature=yes",
"render": "{tag_apply($tags, Add all the suggested tags, apply_icon.svg, _closest_osm_hotel)}"
}
]
}
}