From 3179e59f53c718e0813b182416e7b173b56d795a Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sun, 27 Dec 2020 21:44:49 +0100 Subject: [PATCH] Fix rendering of questions, they update now with the tags --- UI/Popup/TagRenderingQuestion.ts | 4 +--- UI/SpecialVisualizations.ts | 7 ++++++- package.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index 36f152f4a..f38712323 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -113,7 +113,6 @@ export default class TagRenderingQuestion extends UIElement { } private GenerateMultiAnswer(elements: InputElement[], freeformField: InputElement): InputElement { - const possibleTags = elements.map(el => el.GetValue().data); const checkBoxes = new CheckBoxes(elements); const inputEl = new InputElementMap( checkBoxes, @@ -125,8 +124,7 @@ export default class TagRenderingQuestion extends UIElement { return undefined; } const tags: TagsFilter[] = indices.map(i => elements[i].GetValue().data); - const multi = TagUtils.FlattenMultiAnswer(tags); - return multi; + return TagUtils.FlattenMultiAnswer(tags); }, (tags: TagsFilter) => { // {key --> values[]} diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index 2da5fbb2e..b40b02400 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -29,7 +29,12 @@ export class SubstitutedTranslation extends UIElement { this.translation = translation; this.tags = tags; const self = this; - Locale.language.addCallbackAndRun(() => { + tags.addCallbackAndRun(() => { + self.content = self.CreateContent(); + self.Update(); + }); + + Locale.language.addCallback(() => { self.content = self.CreateContent(); self.Update(); }); diff --git a/package.json b/package.json index 0bf725a05..deaf15a4e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "prepare-deploy": "npm run generate:editor-layer-index && npm run generate:layouts && npm run generate && npm run build && rm -rf .cache", "deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", "deploy:production": "rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf /home/pietervdvn/git/mapcomplete.github.io/* && cp -r dist/* /home/pietervdvn/git/mapcomplete.github.io/ && cd /home/pietervdvn/git/mapcomplete.github.io/ && echo \"mapcomplete.osm.be\" > CNAME && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", - "clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(index\\|land\\|test\\|preferences\\|customGenerator\\).html\" | xargs rm) && (find *.webmanifest | xargs rm)" + "clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(index\\|land\\|test\\|preferences\\|customGenerator\\).html\" | xargs rm) && rm *.webmanifest" }, "keywords": [ "OpenStreetMap",