More translation fixes, allows re-enabling questions (fix #51)
This commit is contained in:
parent
400d268651
commit
0bb5abec3c
10 changed files with 83 additions and 37 deletions
|
@ -11,6 +11,7 @@ import {OsmLink} from "../Customizations/Questions/OsmLink";
|
|||
import {WikipediaLink} from "../Customizations/Questions/WikipediaLink";
|
||||
import {And} from "../Logic/TagsFilter";
|
||||
import {TagDependantUIElement, TagDependantUIElementConstructor} from "../Customizations/UIElementConstructor";
|
||||
import Translations from "./i18n/Translations";
|
||||
|
||||
export class FeatureInfoBox extends UIElement {
|
||||
|
||||
|
@ -24,10 +25,13 @@ export class FeatureInfoBox extends UIElement {
|
|||
private _wikipedialink: UIElement;
|
||||
|
||||
|
||||
|
||||
private _infoboxes: TagDependantUIElement[];
|
||||
private _questions: QuestionPicker;
|
||||
|
||||
private _oneSkipped = Translations.t.general.oneSkippedQuestion.Clone();
|
||||
private _someSkipped = Translations.t.general.skippedQuestions.Clone();
|
||||
|
||||
|
||||
constructor(
|
||||
tagsES: UIEventSource<any>,
|
||||
title: TagRenderingOptions | UIElement,
|
||||
|
@ -41,14 +45,28 @@ export class FeatureInfoBox extends UIElement {
|
|||
this._userDetails = userDetails;
|
||||
this.ListenTo(userDetails);
|
||||
|
||||
const deps = {tags:this._tagsES , changes:this._changes}
|
||||
|
||||
const deps = {tags: this._tagsES, changes: this._changes}
|
||||
|
||||
this._infoboxes = [];
|
||||
elementsToShow = elementsToShow ?? []
|
||||
|
||||
const self = this;
|
||||
for (const tagRenderingOption of elementsToShow) {
|
||||
this._infoboxes.push(
|
||||
self._infoboxes.push(
|
||||
tagRenderingOption.construct(deps));
|
||||
}
|
||||
function initTags() {
|
||||
self._infoboxes = []
|
||||
for (const tagRenderingOption of elementsToShow) {
|
||||
self._infoboxes.push(
|
||||
tagRenderingOption.construct(deps));
|
||||
}
|
||||
self.Update();
|
||||
}
|
||||
|
||||
this._someSkipped.onClick(initTags)
|
||||
this._oneSkipped.onClick(initTags)
|
||||
|
||||
|
||||
title = title ?? new TagRenderingOptions(
|
||||
{
|
||||
|
@ -71,13 +89,16 @@ export class FeatureInfoBox extends UIElement {
|
|||
|
||||
|
||||
const info = [];
|
||||
const questions : TagDependantUIElement[] = [];
|
||||
|
||||
const questions: TagDependantUIElement[] = [];
|
||||
let skippedQuestions = 0;
|
||||
for (const infobox of this._infoboxes) {
|
||||
if (infobox.IsKnown()) {
|
||||
info.push(infobox);
|
||||
} else if (infobox.IsQuestioning()) {
|
||||
questions.push(infobox);
|
||||
} else {
|
||||
// This question is neither known nor questioning -> it was skipped
|
||||
skippedQuestions++;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,6 +118,10 @@ export class FeatureInfoBox extends UIElement {
|
|||
}
|
||||
|
||||
questionsHtml = mostImportantQuestion.Render();
|
||||
} else if (skippedQuestions == 1) {
|
||||
questionsHtml = this._oneSkipped.Render();
|
||||
} else if (skippedQuestions > 0) {
|
||||
questionsHtml = this._someSkipped.Render();
|
||||
}
|
||||
|
||||
return "<div class='featureinfobox'>" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue