Fix image upload status indication

This commit is contained in:
Pieter Vander Vennet 2021-10-20 00:34:26 +02:00
parent 668e68f874
commit 1c4cf78a03
2 changed files with 17 additions and 4 deletions

View file

@ -16,8 +16,16 @@ import {VariableUiElement} from "../Base/VariableUIElement";
export class ImageUploadFlow extends Toggle {
private static readonly uploadCountsPerId = new Map<string, UIEventSource<number>>()
constructor(tagsSource: UIEventSource<any>, imagePrefix: string = "image", text: string = undefined) {
const uploadedCount = new UIEventSource<number>(0)
const perId = ImageUploadFlow.uploadCountsPerId
const id = tagsSource.data.id
if(!perId.has(id)){
perId.set(id, new UIEventSource<number>(0))
}
const uploadedCount = perId.get(id)
const uploader = new ImgurUploader(url => {
// A file was uploaded - we add it to the tags of the object
@ -125,7 +133,10 @@ export class ImageUploadFlow extends Toggle {
if(l == 0){
return undefined;
}
return t.uploadDone.Clone().SetClass("thanks");
if(l == 1){
return t.uploadDone.Clone().SetClass("thanks");
}
return t.uploadMultipleDone.Subs({count: l}).SetClass("thanks")
})),
fileSelector,

View file

@ -207,7 +207,8 @@
"overrideAll": {
"allowSplit": true,
"tagRenderings+": [
{"id": "is_cyclestreet",
{
"id": "is_cyclestreet",
"question": {
"nl": "Is deze straat een fietsstraat?",
"en": "Is this street a cyclestreet?",
@ -283,7 +284,8 @@
}
]
},
{"id": "future_cyclestreet",
{
"id": "future_cyclestreet",
"question": {
"nl": "Wanneer wordt deze straat een fietsstraat?",
"en": "When will this street become a cyclestreet?",