From 8ad7afeb83b4b66e9f58ec302b8639519204c511 Mon Sep 17 00:00:00 2001 From: Ruben Bimberg <ruben.bimberg@mni.thm.de> Date: Wed, 1 Sep 2021 11:32:24 +0200 Subject: [PATCH] Fix wrong messages --- .../shared/tag-cloud/tag-cloud.component.ts | 45 ++++++++++--------- .../view-comment-data.component.html | 4 +- .../view-comment-data.component.ts | 1 + .../write-comment.component.html | 1 + src/assets/i18n/creator/de.json | 5 ++- src/assets/i18n/creator/en.json | 5 ++- src/assets/i18n/participant/de.json | 5 ++- src/assets/i18n/participant/en.json | 5 ++- 8 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.ts b/src/app/components/shared/tag-cloud/tag-cloud.component.ts index 6348f4205..29ca074b9 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts @@ -193,30 +193,14 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit { this.authenticationService.guestLogin(UserRole.PARTICIPANT).subscribe(r => { this.roomService.getRoomByShortId(this.shortId).subscribe(room => { this.room = room; + this.retrieveTagCloudSettings(room); this.roomId = room.id; this._subscriptionRoom = this.wsRoomService.getRoomStream(this.roomId).subscribe(msg => { const message = JSON.parse(msg.body); if (message.type === 'RoomPatched') { this.room.questionsBlocked = message.payload.changes.questionsBlocked; this.room.blacklistIsActive = message.payload.changes.blacklistIsActive; - const data = JSON.parse(message.payload.changes.tagCloudSettings); - if (data) { - const admin = TopicCloudAdminService.getDefaultAdminData; - admin.considerVotes = data.admin.considerVotes; - admin.keywordORfulltext = data.admin.keywordORfulltext; - admin.wantedLabels = data.admin.wantedLabels; - admin.minQuestioners = data.admin.minQuestioners; - admin.minQuestions = data.admin.minQuestions; - admin.minUpvotes = data.admin.minUpvotes; - admin.startDate = data.admin.startDate; - admin.endDate = data.admin.endDate; - data.admin = undefined; - this.topicCloudAdmin.setAdminData(admin, false, this.userRole); - this.setCloudParameters(data as CloudParameters); - } else { - this.resetColorsToTheme(); - this.setCloudParameters(this.currentCloudParameters); - } + this.retrieveTagCloudSettings(message.payload.changes); } }); this.directSend = this.room.directSend; @@ -370,18 +354,39 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit { TopicCloudAdminService.applySettingsToRoom(room); this.room = room; this.roomService.updateRoom(room).subscribe(_ => { - this.translateService.get('topic-cloud.changes-successful').subscribe(msg => { + this.translateService.get('tag-cloud.changes-successful').subscribe(msg => { this.notificationService.show(msg); }); }, error => { - this.translateService.get('topic-cloud.changes-gone-wrong').subscribe(msg => { + this.translateService.get('tag-cloud.changes-gone-wrong').subscribe(msg => { this.notificationService.show(msg); }); }); }); } + private retrieveTagCloudSettings(room: Room) { + const data = JSON.parse(room.tagCloudSettings); + if (data) { + const admin = TopicCloudAdminService.getDefaultAdminData; + admin.considerVotes = data.admin.considerVotes; + admin.keywordORfulltext = data.admin.keywordORfulltext; + admin.wantedLabels = data.admin.wantedLabels; + admin.minQuestioners = data.admin.minQuestioners; + admin.minQuestions = data.admin.minQuestions; + admin.minUpvotes = data.admin.minUpvotes; + admin.startDate = data.admin.startDate; + admin.endDate = data.admin.endDate; + data.admin = undefined; + this.topicCloudAdmin.setAdminData(admin, false, this.userRole); + this.setCloudParameters(data as CloudParameters); + } else { + this.resetColorsToTheme(); + this.setCloudParameters(this.currentCloudParameters); + } + } + private updateAlphabeticalPosition(elements: TagComment[]): void { const sizes = new Array(10); const fontRange = (this._currentSettings.fontSizeMax - this._currentSettings.fontSizeMin) / 10; diff --git a/src/app/components/shared/view-comment-data/view-comment-data.component.html b/src/app/components/shared/view-comment-data/view-comment-data.component.html index 647fe95b4..dd342f901 100644 --- a/src/app/components/shared/view-comment-data/view-comment-data.component.html +++ b/src/app/components/shared/view-comment-data/view-comment-data.component.html @@ -9,10 +9,10 @@ <div #tooltipContainer></div> <div fxLayout="row" style="justify-content: space-between; padding: 0 5px"> <span aria-hidden="true" style="font-size: 75%"> - {{ 'comment-page.Markdown-hint' | translate }} + {{currentText.length}} / {{maxTextCharacters}} </span> <span aria-hidden="true" style="font-size: 75%"> - {{currentText.length}} / {{maxTextCharacters}} + {{'comment-page.format-count' | translate: {count: currentData.length, length: maxDataCharacters} }} </span> </div> </ars-row> diff --git a/src/app/components/shared/view-comment-data/view-comment-data.component.ts b/src/app/components/shared/view-comment-data/view-comment-data.component.ts index ac59274cf..805ed043b 100644 --- a/src/app/components/shared/view-comment-data/view-comment-data.component.ts +++ b/src/app/components/shared/view-comment-data/view-comment-data.component.ts @@ -34,6 +34,7 @@ export class ViewCommentDataComponent implements OnInit, AfterViewInit { @Input() user: User; @Input() currentData = ''; @Input() maxTextCharacters = 500; + @Input() maxDataCharacters = 1500; @Input() markEvents?: { onCreate: (markContainer: HTMLDivElement, tooltipContainer: HTMLDivElement, editor: QuillEditorComponent) => void; onChange: (delta: any) => void; diff --git a/src/app/components/shared/write-comment/write-comment.component.html b/src/app/components/shared/write-comment/write-comment.component.html index 5a2f19a71..0c6189d9d 100644 --- a/src/app/components/shared/write-comment/write-comment.component.html +++ b/src/app/components/shared/write-comment/write-comment.component.html @@ -49,6 +49,7 @@ [user]="user" [isEditor]="true" [maxTextCharacters]="maxTextCharacters" + [maxDataCharacters]="maxDataCharacters" [markEvents]="getMarkEvents()"></app-view-comment-data> <ars-row ars-flex-box *ngIf="enabled" class="spellcheck"> <ars-col> diff --git a/src/assets/i18n/creator/de.json b/src/assets/i18n/creator/de.json index 5e543d7ca..f4003ad8a 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -147,6 +147,7 @@ "exit-description": "Präsentation verlassen", "export": "Exportieren", "export-description": "Exportieren", + "format-count": "Formatierungszeichen {{count}}/{{length}}", "live-announcer": "Du befindest dich jetzt auf der Fragen-Seite. Um Informationen zu Tastenkombinationen zu erhalten drücke jetzt die Enter-Taste oder rufe die Ansage zu einem späteren Zeitpunkt mit der Escape-Taste auf.", "live-announcer-moderation": "Du befindest dich jetzt auf der Moderations-Seite. Um Informationen zu Tastenkombinationen zu erhalten drücke jetzt die Enter-Taste oder rufe die Ansage zu einem späteren Zeitpunkt mit der Escape-Taste auf.", "mark-correct": "Frage bejahen", @@ -468,7 +469,9 @@ "period-since-first-comment":"Zeitraum seit der ersten Frage", "upvote-topic": "Up-Votes für dieses Thema", "downvote-topic": "Down-Votes für dieses Thema", - "blacklist-topic": "Thema auf die »Blacklist« setzen" + "blacklist-topic": "Thema auf die »Blacklist« setzen", + "changes-gone-wrong": "Etwas ist schiefgelaufen!", + "changes-successful": "Änderungen gespeichert." }, "tag-cloud-config": { "general": "Allgemein", diff --git a/src/assets/i18n/creator/en.json b/src/assets/i18n/creator/en.json index 4714d563e..3a595fb79 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -148,6 +148,7 @@ "exit-description": "Exit Presentation Mode", "export": "Export", "export-description": "Export", + "format-count": "Formatting characters {{count}}/{{length}}", "live-announcer": "You are now on the questions page. To get information about key combinations press the Enter key or call the announcement later with the Escape key.", "live-announcer-moderation": "You are now on the moderation page. To get information about key combinations press the Enter key or call the announcement later with the Escape key.", "mark-correct": "Mark as correct", @@ -377,7 +378,9 @@ "period-since-first-comment":"Period since first comment", "upvote-topic": "Upvotes for this topic", "downvote-topic": "Downvotes for this topic", - "blacklist-topic": "Add topic to blacklist" + "blacklist-topic": "Add topic to blacklist", + "changes-gone-wrong": "Something went wrong!", + "changes-successful": "Successfully updated." }, "tag-cloud-popup": { "few-seconds": "few seconds", diff --git a/src/assets/i18n/participant/de.json b/src/assets/i18n/participant/de.json index a0f87e838..a243678dd 100644 --- a/src/assets/i18n/participant/de.json +++ b/src/assets/i18n/participant/de.json @@ -131,6 +131,7 @@ "error-comment-text": "Dein Text ist zu lang. Bitte kürze ihn.", "error-comment-data": "Zu viele Formatierungen oder verknüpfte Elemente. Bitte entferne einige.", "error-title": "Bitte gib einen Titel ein.", + "format-count": "Formatierungszeichen {{count}}/{{length}}", "has-answer": "Die Frage wurde kommentiert. Klick hier, um den Kommentar zu lesen.", "exit-description": "Präsentationsmodus verlassen", "live-announcer": "Du befindest dich jetzt auf der Fragen-Seite. Um Informationen zu Tastenkombinationen zu erhalten drücke jetzt die Enter-Taste oder rufe die Ansage zu einem späteren Zeitpunkt mit der Escape-Taste auf.", @@ -272,7 +273,9 @@ "period-since-first-comment":"Zeitraum seit der ersten Frage", "upvote-topic": "Up-Votes für dieses Thema", "downvote-topic": "Down-Votes für dieses Thema", - "blacklist-topic": "Thema auf die »Blacklist« setzen" + "blacklist-topic": "Thema auf die »Blacklist« setzen", + "changes-gone-wrong": "Etwas ist schiefgelaufen!", + "changes-successful": "Änderungen gespeichert." }, "tag-cloud-popup": { "few-seconds": "wenige Sekunden", diff --git a/src/assets/i18n/participant/en.json b/src/assets/i18n/participant/en.json index be4675cb8..040cd7cc8 100644 --- a/src/assets/i18n/participant/en.json +++ b/src/assets/i18n/participant/en.json @@ -141,6 +141,7 @@ "error-comment-data": "Too much formatting or linked elements. Please remove some.", "error-title": "Please enter a title.", "exit-description": "Exit Presentation Mode", + "format-count": "Formatting characters {{count}}/{{length}}", "has-answer": "The question was answered. Click for full view.", "live-announcer": "You are now on the questions page. To get information about key combinations press the Enter key or call the announcement later with the Escape key.", "mark-not-correct": "Marked as correct", @@ -278,7 +279,9 @@ "period-since-first-comment":"Period since first comment", "upvote-topic": "Upvotes for this topic", "downvote-topic": "Downvotes for this topic", - "blacklist-topic": "Add topic to blacklist" + "blacklist-topic": "Add topic to blacklist", + "changes-gone-wrong": "Something went wrong!", + "changes-successful": "Successfully updated." }, "tag-cloud-popup": { "few-seconds": "few seconds", -- GitLab