Show buttons for adding tags and importing
This commit is contained in:
parent
512282772a
commit
63bb1a4da3
2 changed files with 19 additions and 0 deletions
|
@ -42,6 +42,13 @@ export default class TagApplyButton implements AutoAction {
|
||||||
|
|
||||||
public static generateTagsToApply(spec: string, tagSource: Store<any>): Store<Tag[]> {
|
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 tgsSpec = spec.split(";").map(spec => {
|
||||||
const kv = spec.split("=").map(s => s.trim());
|
const kv = spec.split("=").map(s => s.trim());
|
||||||
if (kv.length != 2) {
|
if (kv.length != 2) {
|
||||||
|
|
|
@ -39,6 +39,18 @@
|
||||||
"_closest_osm_hotel=feat.closest('hotel')?.properties?.id",
|
"_closest_osm_hotel=feat.closest('hotel')?.properties?.id",
|
||||||
"_closest_osm_hotel_distance=feat.distanceTo(feat.properties._closest_osm_hotel)",
|
"_closest_osm_hotel_distance=feat.distanceTo(feat.properties._closest_osm_hotel)",
|
||||||
"_has_closeby_feature=Number(feat.properties._closest_osm_hotel_distance) < 50 ? 'yes' : 'no'"
|
"_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)}"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue