Fixed reviews for named elements

This commit is contained in:
pietervdvn 2020-12-31 22:41:52 +01:00
parent e7dcd350fe
commit 287470acff
4 changed files with 14 additions and 7 deletions

View file

@ -25,7 +25,7 @@ export default class State {
// The singleton of the global state // The singleton of the global state
public static state: State; public static state: State;
public static vNumber = "0.2.6"; public static vNumber = "0.2.6a";
// The user journey states thresholds when a new feature gets unlocked // The user journey states thresholds when a new feature gets unlocked
public static userJourney = { public static userJourney = {

View file

@ -38,7 +38,7 @@ export class SubstitutedTranslation extends UIElement {
self.content = self.CreateContent(); self.content = self.CreateContent();
self.Update(); self.Update();
}); });
} }
InnerRender(): string { InnerRender(): string {
@ -93,7 +93,7 @@ export class SubstitutedTranslation extends UIElement {
return [...partBefore, element, ...partAfter] return [...partBefore, element, ...partAfter]
} catch (e) { } catch (e) {
console.error(e); console.error(e);
return [...partBefore,new FixedUiElement(`Failed loading ${knownSpecial.funcName}(${matched[2]}): ${e}`) , ...partAfter] return [...partBefore, new FixedUiElement(`Failed loading ${knownSpecial.funcName}(${matched[2]}): ${e}`), ...partAfter]
} }
} }
} }
@ -163,10 +163,17 @@ export default class SpecialVisualizations {
{ {
funcName: "reviews", funcName: "reviews",
docs: "Adds an overview of the mangrove-reviews of this object. IMPORTANT: the _name_ of the object should be defined for this to work!", docs: "Adds an overview of the mangrove-reviews of this object. IMPORTANT: the _name_ of the object should be defined for this to work!",
args: [{name:"subject", doc:"The identifier used for this value; by default the name of the reviewed object"}], args: [{
name: "subject",
doc: "The identifier used for this value; by default the name of the reviewed object"
}],
constr: (tags, args) => { constr: (tags, args) => {
const tgs = tags.data; const tgs = tags.data;
const subject = args[0] ?? tgs.name ?? ""; console.log("Args[0]", args[0])
const subject = tgs.name ?? "";
if (args[0] !== undefined && args[0] !== "") {
subject = args[0];
}
if (subject === "") { if (subject === "") {
return Translations.t.reviews.name_required; return Translations.t.reviews.name_required;
} }

View file

@ -20,7 +20,7 @@
"startZoom": 10, "startZoom": 10,
"widenFactor": 0.05, "widenFactor": 0.05,
"socialImage": "", "socialImage": "",
"hideInoverview": true, "hideFromOverview": true,
"layers": [ "layers": [
{ {
"id": "playgrounds", "id": "playgrounds",

View file

@ -86,7 +86,7 @@ function generateWikiEntry(layout: LayoutConfig){
auth=`Yes, by ${layout.maintainer};` auth=`Yes, by ${layout.maintainer};`
} }
return `{{service_item return `{{service_item
|name= [https://mapcomplete.osm.be/${layout.id}.html ${layout.id}] |name= [https://mapcomplete.osm.be/${layout.id} ${layout.id}]
|region= Worldwide |region= Worldwide
|lang= ${languages} |lang= ${languages}
|descr= A MapComplete theme: ${Translations.W(layout.description) |descr= A MapComplete theme: ${Translations.W(layout.description)