forked from MapComplete/MapComplete
More fancyness, less bugs
This commit is contained in:
parent
16612b10ef
commit
2177db376c
27 changed files with 821 additions and 607 deletions
|
@ -29,6 +29,8 @@ export default class EditableTagRendering extends UIElement {
|
|||
|
||||
this._answer = new TagRenderingAnswer(tags, configuration);
|
||||
this._answer.SetStyle("width:100%;")
|
||||
this._question = this.GenerateQuestion();
|
||||
this.dumbMode = false;
|
||||
|
||||
if (this._configuration.question !== undefined) {
|
||||
if (State.state.featureSwitchUserbadge.data) {
|
||||
|
@ -66,7 +68,6 @@ export default class EditableTagRendering extends UIElement {
|
|||
InnerRender(): string {
|
||||
|
||||
if (this._editMode.data) {
|
||||
this._question = this.GenerateQuestion();
|
||||
return this._question.Render();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ export class FeatureInfoBox extends UIElement {
|
|||
layerConfig: LayerConfig
|
||||
) {
|
||||
super();
|
||||
if(layerConfig === undefined){
|
||||
if (layerConfig === undefined) {
|
||||
throw "Undefined layerconfig"
|
||||
}
|
||||
this._tags = tags;
|
||||
|
@ -30,7 +30,7 @@ export class FeatureInfoBox extends UIElement {
|
|||
|
||||
this._title = layerConfig.title === undefined ? undefined :
|
||||
new TagRenderingAnswer(tags, layerConfig.title)
|
||||
.SetClass("featureinfobox-title");
|
||||
.SetClass("featureinfobox-title");
|
||||
this._titleIcons = new Combine(
|
||||
layerConfig.titleIcons.map(icon => new TagRenderingAnswer(tags, icon)))
|
||||
.SetClass("featureinfobox-icons");
|
||||
|
|
|
@ -102,7 +102,20 @@ export default class SpecialVisualizations {
|
|||
args: { name: string, defaultValue?: string, doc: string }[]
|
||||
}[] =
|
||||
|
||||
[
|
||||
[{
|
||||
funcName: "all_tags",
|
||||
docs: "Prints all key-value pairs of the object - used for debugging",
|
||||
args: [],
|
||||
constr: ((tags: UIEventSource<any>) => {
|
||||
return new VariableUiElement(tags.map(tags => {
|
||||
const parts = [];
|
||||
for (const key in tags) {
|
||||
parts.push(key + "=" + tags[key]);
|
||||
}
|
||||
return parts.join("<br/>")
|
||||
})).SetStyle("border: 1px solid black; border-radius: 1em;padding:1em;display:block;")
|
||||
})
|
||||
},
|
||||
{
|
||||
funcName: "image_carousel",
|
||||
docs: "Creates an image carousel for the given sources. An attempt will be made to guess what source is used. Supported: Wikidata identifiers, Wikipedia pages, Wikimedia categories, IMGUR (with attribution, direct links)",
|
||||
|
@ -170,21 +183,7 @@ export default class SpecialVisualizations {
|
|||
return new VariableUiElement(source.map(data => data[neededValue] ?? "Loading..."));
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
funcName: "all_tags",
|
||||
docs: "Prints all key-value pairs of the object - used for debugging",
|
||||
args:[],
|
||||
constr: ((tags: UIEventSource<any>) => {
|
||||
return new VariableUiElement(tags.map(tags => {
|
||||
const parts = [];
|
||||
for (const key in tags) {
|
||||
parts.push(key+"="+tags[key]);
|
||||
}
|
||||
return parts.join("<br/>")
|
||||
})).SetStyle("border: 1px solid black; border-radius: 1em;padding:1em;display:block;")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
static HelpMessage: UIElement = SpecialVisualizations.GenHelpMessage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue