forked from MapComplete/MapComplete
Update to climbing theme
This commit is contained in:
parent
116371c351
commit
c25e039a91
3 changed files with 32 additions and 18 deletions
|
@ -505,22 +505,27 @@
|
|||
"images",
|
||||
"questions",
|
||||
{
|
||||
"#": "Contained routes",
|
||||
"render": "<h3>Contains the following routes</h3> <ul>{_contained_climbing_routes}</ul>",
|
||||
"condition": "_contained_climbing_routes~*"
|
||||
}, {
|
||||
"#": "Contained routes length hist",
|
||||
"render": {
|
||||
"en": "<h3>Length overview</h3>{histogram(_length_hist)}"
|
||||
}
|
||||
},
|
||||
"condition": "_length_hist!~\\[\\]"
|
||||
},
|
||||
{
|
||||
"#": "Contained routes hist",
|
||||
"render": {
|
||||
"en": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist)}"
|
||||
}
|
||||
"en": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist, , , 3[a-zA-Z+-]*:#56bd56, 4[a-zA-Z+-]*:#ffff59,5[a-zA-Z+-]*:#ffad48, 6[a-zA-Z+-]*:#63a9ff, 7[a-zA-Z+-]*:#ff5858, 8[a-zA-Z+-]*:#000000, .*:#aaa )}"
|
||||
|
||||
},
|
||||
"condition": "_difficulty_hist!~\\[\\]"
|
||||
},
|
||||
{
|
||||
"#": "Containe {_contained_climbing_routes_count} routes",
|
||||
"render": {
|
||||
"en": "<h3>Contains {_contained_climbing_routes_count} routes</h3> <ul>{_contained_climbing_routes}</ul>"
|
||||
},
|
||||
"condition": "_contained_climbing_routes~*"
|
||||
},
|
||||
|
||||
{
|
||||
"#": "name",
|
||||
"render": {
|
||||
|
@ -622,7 +627,8 @@
|
|||
"_contained_climbing_routes_properties=feat.overlapWith('climbing_route').map(f => f.feat.properties).map(p => {return {id: p.id, name: p.name, 'climbing:grade:french': p['climbing:grade:french'], 'climbing:length': p['climbing:length']} })",
|
||||
"_contained_climbing_routes=JSON.parse(feat.properties._contained_climbing_routes_properties ?? '[]').map(p => `<li><a href='#${p.id}'>${p.name ?? 'climbing route'}</a> (<b>${p['climbing:grade:french'] ?? 'unknown difficulty'}</b>, ${p['climbing:length'] ?? 'unkown length'} meter)</li>`).join('')",
|
||||
"_difficulty_hist=JSON.parse(feat.properties._contained_climbing_routes_properties ?? '[]').map(p => p['climbing:grade:french'])",
|
||||
"_length_hist=JSON.parse(feat.properties._contained_climbing_routes_properties ?? '[]').map(p => p['climbing:length'])"
|
||||
"_length_hist=JSON.parse(feat.properties._contained_climbing_routes_properties ?? '[]').map(p => p['climbing:length'])",
|
||||
"_contained_climbing_routes_count=JSON.parse(_contained_climbing_routes).length"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -654,15 +660,15 @@
|
|||
},
|
||||
"title": {
|
||||
"render": {
|
||||
"en": "Climbing opportunity?",
|
||||
"nl": "Klimgelegenheid?",
|
||||
"en": "Possible climbing opportunity",
|
||||
"nl": "Mogelijke klimgelegenheid",
|
||||
"de": "Klettermöglichkeit?",
|
||||
"ja": "登坂教室?",
|
||||
"nb_NO": "Klatremulighet?"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"nl": "Een klimgelegenheid?",
|
||||
"nl": "Een mogelijke klimgelegenheid?",
|
||||
"de": "Eine Klettergelegenheit?",
|
||||
"en": "A climbing opportunity?",
|
||||
"ja": "登坂教室?",
|
||||
|
@ -1226,13 +1232,12 @@
|
|||
}
|
||||
],
|
||||
"overrideAll": {
|
||||
"calculatedTags+": [
|
||||
"+calculatedTags": [
|
||||
"_embedding_feature_properties=feat.overlapWith('climbing').map(f => f.feat.properties).filter(p => p !== undefined).map(p => {return{access: p.access, id: p.id, name: p.name, climbing: p.climbing, 'access:description': p['access:description']}})",
|
||||
"_embedding_features_with_access=JSON.parse(feat.properties._embedding_feature_properties ?? '[]').filter(p => p.access !== undefined)[0]",
|
||||
"_embedding_feature:access=JSON.parse(feat.properties._embedding_features_with_access ?? '{}').access",
|
||||
"_embedding_feature:access:description=JSON.parse(feat.properties._embedding_features_with_access ?? '{}')['access:description']",
|
||||
"_embedding_feature:id=JSON.parse(feat.properties._embedding_features_with_access ?? '{}').id",
|
||||
"_layer=feat._layer_id"
|
||||
"_embedding_feature:id=JSON.parse(feat.properties._embedding_features_with_access ?? '{}').id"
|
||||
]
|
||||
}
|
||||
}
|
9
test.ts
9
test.ts
|
@ -10,6 +10,8 @@ import {FixedUiElement} from "./UI/Base/FixedUiElement";
|
|||
import Img from "./UI/Base/Img";
|
||||
import {AttributedImage} from "./UI/Image/AttributedImage";
|
||||
import {Imgur} from "./Logic/Web/Imgur";
|
||||
import ReviewForm from "./UI/Reviews/ReviewForm";
|
||||
import {OsmConnection} from "./Logic/Osm/OsmConnection";
|
||||
|
||||
|
||||
function TestSlideshow(){
|
||||
|
@ -17,7 +19,7 @@ function TestSlideshow(){
|
|||
new FixedUiElement("A"),
|
||||
new FixedUiElement("qmsldkfjqmlsdkjfmqlskdjfmqlksdf").SetClass("text-xl"),
|
||||
new Img("https://i.imgur.com/8lIQ5Hv.jpg"),
|
||||
new AttributedImage("https://i.imgur.com/y5XudzW.jpg", new Imgur()),
|
||||
new AttributedImage("https://i.imgur.com/y5XudzW.jpg", Imgur.singleton),
|
||||
new Img("https://www.grunge.com/img/gallery/the-real-reason-your-cat-sleeps-so-much/intro-1601496900.webp")
|
||||
])
|
||||
new SlideShow(elems).AttachTo("maindiv")
|
||||
|
@ -62,5 +64,6 @@ function TestAllInputMethods(){
|
|||
})).AttachTo("maindiv")
|
||||
}
|
||||
|
||||
|
||||
TestSlideshow()
|
||||
new ReviewForm(() => {
|
||||
return undefined;
|
||||
}, new OsmConnection(true, new UIEventSource<string>(undefined), "test")).AttachTo("maindiv");
|
|
@ -88,6 +88,12 @@ export default class TagSpec extends T{
|
|||
equal(assign.matchesProperties({"survey:date": "2021-03-29"}), false);
|
||||
equal(assign.matchesProperties({"_date:now": "2021-03-29"}), false);
|
||||
equal(assign.matchesProperties({"some_key": "2021-03-29"}), false);
|
||||
|
||||
const notEmptyList = FromJSON.Tag("xyz!~\\[\\]")
|
||||
equal(notEmptyList.matchesProperties({"xyz":undefined}), true);
|
||||
equal(notEmptyList.matchesProperties({"xyz":"[]"}), false);
|
||||
equal(notEmptyList.matchesProperties({"xyz":"[\"abc\"]"}), true);
|
||||
|
||||
|
||||
})],
|
||||
["Is equivalent test", (() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue