Another sanity check, another bunch of fixed layers; add tagrendering-steal possibility, add some styling to TV-theme
This commit is contained in:
parent
10ac6a72e2
commit
746273f594
57 changed files with 602 additions and 940 deletions
|
@ -2,7 +2,7 @@ import {Utils} from "../Utils";
|
|||
|
||||
export default class Constants {
|
||||
|
||||
public static vNumber = "0.12.5";
|
||||
public static vNumber = "0.12.6";
|
||||
public static ImgurApiKey = '7070e7167f0a25a'
|
||||
public static readonly mapillary_client_token_v3 = 'TXhLaWthQ1d4RUg0czVxaTVoRjFJZzowNDczNjUzNmIyNTQyYzI2'
|
||||
public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"
|
||||
|
|
|
@ -173,10 +173,47 @@ export default class TagRenderingConfig {
|
|||
throw `${context}: A question is defined, but no mappings nor freeform (key) are. The question is ${this.question.txt} at ${context}`
|
||||
}
|
||||
|
||||
if (this.freeform && this.render === undefined) {
|
||||
throw `${context}: Detected a freeform key without rendering... Key: ${this.freeform.key} in ${context}`
|
||||
if (this.freeform) {
|
||||
if(this.render === undefined){
|
||||
throw `${context}: Detected a freeform key without rendering... Key: ${this.freeform.key} in ${context}`
|
||||
}
|
||||
for (const ln in this.render.translations) {
|
||||
const txt :string = this.render.translations[ln]
|
||||
if(txt === ""){
|
||||
throw context+" Rendering for language "+ln+" is empty"
|
||||
}
|
||||
if(txt.indexOf("{"+this.freeform.key+"}") >= 0){
|
||||
continue
|
||||
}
|
||||
if(txt.indexOf("{canonical("+this.freeform.key+")") >= 0){
|
||||
continue
|
||||
}
|
||||
if(this.freeform.type === "opening_hours" && txt.indexOf("{opening_hours_table(") >= 0){
|
||||
continue
|
||||
}
|
||||
if(this.freeform.type === "wikidata" && txt.indexOf("{wikipedia("+this.freeform.key) >= 0){
|
||||
continue
|
||||
}
|
||||
if(this.freeform.key === "wikidata" && txt.indexOf("{wikipedia()") >= 0){
|
||||
continue
|
||||
}
|
||||
throw `${context}: The rendering for language ${ln} does not contain the freeform key {${this.freeform.key}}. This is a bug, as this rendering should show exactly this freeform key!\nThe rendering is ${txt} `
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (this.id === "questions" && this.render !== undefined) {
|
||||
for (const ln in this.render.translations) {
|
||||
const txt :string = this.render.translations[ln]
|
||||
if(txt.indexOf("{questions}") >= 0){
|
||||
continue
|
||||
}
|
||||
throw `${context}: The rendering for language ${ln} does not contain {questions}. This is a bug, as this rendering should include exactly this to trigger those questions to be shown!`
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.render && this.question && this.freeform === undefined) {
|
||||
throw `${context}: Detected a tagrendering which takes input without freeform key in ${context}; the question is ${this.question.txt}`
|
||||
}
|
||||
|
@ -238,7 +275,7 @@ export default class TagRenderingConfig {
|
|||
public IsKnown(tags: any): boolean {
|
||||
if (this.condition &&
|
||||
!this.condition.matchesProperties(tags)) {
|
||||
// Filtered away by the condition
|
||||
// Filtered away by the condition, so it is kindof known
|
||||
return true;
|
||||
}
|
||||
if (this.multiAnswer) {
|
||||
|
|
|
@ -6,6 +6,10 @@ import {Utils} from "../../Utils";
|
|||
export default class WithContextLoader {
|
||||
protected readonly _context: string;
|
||||
private readonly _json: any;
|
||||
|
||||
public static getKnownTagRenderings : ((id: string) => TagRenderingConfigJson)= function(id) {
|
||||
return SharedTagRenderings.SharedTagRenderingJson.get(id)
|
||||
}
|
||||
|
||||
constructor(json: any, context: string) {
|
||||
this._json = json;
|
||||
|
@ -71,7 +75,7 @@ export default class WithContextLoader {
|
|||
continue;
|
||||
}
|
||||
|
||||
let sharedJson = SharedTagRenderings.SharedTagRenderingJson.get(renderingId)
|
||||
let sharedJson = WithContextLoader.getKnownTagRenderings(renderingId)
|
||||
if (sharedJson === undefined) {
|
||||
const keys = Array.from(SharedTagRenderings.SharedTagRenderingJson.keys());
|
||||
throw `Predefined tagRendering ${renderingId} not found in ${context}.\n Try one of ${keys.join(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue