Translation rework: Confirmation dialog, confirm delete users

This commit is contained in:
Adina Țeudan 2021-07-19 20:19:27 +03:00
parent d7aeb7fbdd
commit da3b1b1379
10 changed files with 205 additions and 190 deletions

View File

@ -1,5 +1,5 @@
<section class="dialog">
<div [translate]="'confirm-delete-users.title.' + type" class="dialog-header heading-l"></div>
<div [translateParams]="{ userCount: users.length }" [translate]="'confirm-delete-users.title'" class="dialog-header heading-l"></div>
<div *ngIf="showToast" class="inline-dialog-toast toast-error">
<div translate="confirm-delete-users.toast-error"></div>
@ -17,15 +17,20 @@
[class.error]="!checkbox.value && showToast"
color="primary"
>
{{ 'confirm-delete-users.' + checkbox.label | translate: { dossiersCount: dossiersCount } }}
{{ checkbox.label | translate: { dossiersCount: dossiersCount, userCount: users.length } }}
</mat-checkbox>
</div>
<div class="dialog-actions">
<button (click)="deleteUser()" color="primary" mat-flat-button>
{{ 'confirm-delete-users.delete.' + type | translate }}
{{ 'confirm-delete-users.delete' | translate: { userCount: users.length } }}
</button>
<div (click)="cancel()" [translate]="'confirm-delete-users.cancel.' + type" class="all-caps-label cancel"></div>
<div
(click)="cancel()"
[translateParams]="{ userCount: users.length }"
[translate]="'confirm-delete-users.cancel'"
class="all-caps-label cancel"
></div>
</div>
<redaction-circle-button class="dialog-close" icon="red:close" mat-dialog-close></redaction-circle-button>
</section>

View File

@ -3,6 +3,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { User, UserControllerService } from '@redaction/red-ui-http';
import { AppStateService } from '@state/app-state.service';
import { LoadingService } from '@services/loading.service';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
@Component({
selector: 'redaction-confirm-delete-users-dialog',
@ -11,8 +12,8 @@ import { LoadingService } from '@services/loading.service';
})
export class ConfirmDeleteUsersDialogComponent {
checkboxes = [
{ value: false, label: 'impacted-dossiers' },
{ value: false, label: 'impacted-documents.' + this.type }
{ value: false, label: _('confirm-delete-users.impacted-dossiers') },
{ value: false, label: _('confirm-delete-users.impacted-documents') }
];
showToast = false;
dossiersCount: number;
@ -38,10 +39,6 @@ export class ConfirmDeleteUsersDialogComponent {
return this.checkboxes[0].value && this.checkboxes[1].value;
}
get type(): 'bulk' | 'single' {
return this.users.length > 1 ? 'bulk' : 'single';
}
async deleteUser() {
if (this.valid) {
this._loadingService.start();

View File

@ -11,6 +11,7 @@ import { DossiersDialogService } from '../../services/dossiers-dialog.service';
import { LoadingService } from '@services/loading.service';
import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
@Component({
selector: 'redaction-dossier-overview-bulk-actions',
@ -137,8 +138,8 @@ export class DossierOverviewBulkActionsComponent {
'confirm',
null,
new ConfirmationDialogInput({
title: 'confirmation-dialog.delete-file.title',
question: 'confirmation-dialog.delete-file.question'
title: _('confirmation-dialog.delete-file.title'),
question: _('confirmation-dialog.delete-file.question')
}),
async () => {
this._loadingService.start();

View File

@ -8,6 +8,7 @@ import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/con
import { LoadingService } from '@services/loading.service';
import { FileManagementControllerService } from '@redaction/red-ui-http';
import { TranslateService } from '@ngx-translate/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
@Component({
selector: 'redaction-file-actions',
@ -119,8 +120,8 @@ export class FileActionsComponent implements OnInit {
'confirm',
$event,
new ConfirmationDialogInput({
title: 'confirmation-dialog.delete-file.title',
question: 'confirmation-dialog.delete-file.question'
title: _('confirmation-dialog.delete-file.title'),
question: _('confirmation-dialog.delete-file.question')
}),
async () => {
this._loadingService.start();

View File

@ -30,6 +30,7 @@ import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/con
import { loadCompareDocumentWrapper } from '../../utils/compare-mode.utils';
import { PdfViewerUtils } from '../../utils/pdf-viewer.utils';
import { ViewMode } from '@models/file/view-mode';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import TextTool = Tools.TextTool;
@Component({
@ -157,8 +158,8 @@ export class PdfViewerComponent implements OnInit, OnChanges {
'confirm',
null,
new ConfirmationDialogInput({
title: 'confirmation-dialog.compare-file.title',
question: 'confirmation-dialog.compare-file.question',
title: _('confirmation-dialog.compare-file.title'),
question: _('confirmation-dialog.compare-file.question'),
translateParams: {
fileName: fileToCompare.name,
currentDocumentPageCount,

View File

@ -9,14 +9,14 @@
(click)="changeTab(item.key)"
*ngFor="let item of navItems"
[class.active]="item.key === activeNav"
[translate]="'edit-dossier-dialog.nav-items.' + item.key"
[translate]="item.sideNavTitle || item.title"
class="item"
></div>
</redaction-side-nav>
<div>
<div [class.no-padding]="noPaddingTab" class="content">
<div *ngIf="showHeading" class="heading">
{{ 'edit-dossier-dialog.nav-items.' + (activeNavItem.title || activeNavItem.key) | translate }}
{{ activeNavItem.title | translate }}
<div *ngIf="showSubtitle" class="small-label stats-subtitle">
<div>
@ -31,19 +31,19 @@
<redaction-edit-dossier-general-info
(updateDossier)="updatedDossier($event)"
*ngIf="activeNav === 'dossier-info'"
*ngIf="activeNav === 'dossierInfo'"
[dossierWrapper]="dossierWrapper"
></redaction-edit-dossier-general-info>
<redaction-edit-dossier-download-package
(updateDossier)="updatedDossier($event)"
*ngIf="activeNav === 'download-package'"
*ngIf="activeNav === 'downloadPackage'"
[dossierWrapper]="dossierWrapper"
></redaction-edit-dossier-download-package>
<redaction-edit-dossier-dictionary
(updateDossier)="updatedDossier($event)"
*ngIf="activeNav === 'dossier-dictionary'"
*ngIf="activeNav === 'dossierDictionary'"
[dossierWrapper]="dossierWrapper"
></redaction-edit-dossier-dictionary>
@ -55,7 +55,7 @@
<redaction-edit-dossier-attributes
(updateDossier)="updatedDossier($event)"
*ngIf="activeNav === 'dossier-attributes'"
*ngIf="activeNav === 'dossierAttributes'"
[dossierWrapper]="dossierWrapper"
></redaction-edit-dossier-attributes>
</div>

View File

@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, Inject, ViewChild } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FormBuilder } from '@angular/forms';
import { AppStateService } from '@state/app-state.service';
import { DossierWrapper } from '../../../../state/model/dossier.wrapper';
import { DossierWrapper } from '@state/model/dossier.wrapper';
import { EditDossierGeneralInfoComponent } from './general-info/edit-dossier-general-info.component';
import { EditDossierDownloadPackageComponent } from './download-package/edit-dossier-download-package.component';
import { EditDossierSectionInterface } from './edit-dossier-section.interface';
@ -12,22 +12,16 @@ import { EditDossierDictionaryComponent } from './dictionary/edit-dossier-dictio
import { EditDossierTeamMembersComponent } from './team-members/edit-dossier-team-members.component';
import { EditDossierAttributesComponent } from './attributes/edit-dossier-attributes.component';
type Section = 'dossier-info' | 'download-package' | 'dossier-dictionary' | 'members' | 'dossier-attributes';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
type Section = 'dossierInfo' | 'downloadPackage' | 'dossierDictionary' | 'members' | 'dossierAttributes';
@Component({
templateUrl: './edit-dossier-dialog.component.html',
styleUrls: ['./edit-dossier-dialog.component.scss']
})
export class EditDossierDialogComponent {
navItems: { key: Section; title?: string }[] = [
{ key: 'dossier-info', title: 'general-info' },
{ key: 'download-package', title: 'choose-download' },
{ key: 'dossier-dictionary', title: 'dossier-dictionary' },
{ key: 'members', title: 'team-members' },
{ key: 'dossier-attributes' }
// TODO:
// { key: 'report-attributes' }
];
readonly navItems: { key: Section; title: string; sideNavTitle?: string }[];
activeNav: Section;
dossierWrapper: DossierWrapper;
@ -51,8 +45,34 @@ export class EditDossierDialogComponent {
section?: Section;
}
) {
this.navItems = [
{
key: 'dossierInfo',
title: _('edit-dossier-dialog.nav-items.general-info'),
sideNavTitle: _('edit-dossier-dialog.nav-items.dossier-info')
},
{
key: 'downloadPackage',
title: _('edit-dossier-dialog.nav-items.choose-download'),
sideNavTitle: _('edit-dossier-dialog.nav-items.download-package')
},
{
key: 'dossierDictionary',
title: _('edit-dossier-dialog.nav-items.dossier-dictionary')
},
{
key: 'members',
title: _('edit-dossier-dialog.nav-items.team-members'),
sideNavTitle: _('edit-dossier-dialog.nav-items.members')
},
{
key: 'dossierAttributes',
title: _('edit-dossier-dialog.nav-items.dossier-attributes')
}
];
this.dossierWrapper = _data.dossierWrapper;
this.activeNav = _data.section || 'dossier-info';
this.activeNav = _data.section || 'dossierInfo';
}
get activeNavItem(): { key: string; title?: string } {
@ -61,24 +81,24 @@ export class EditDossierDialogComponent {
get activeComponent(): EditDossierSectionInterface {
return {
'dossier-info': this.generalInfoComponent,
'download-package': this.downloadPackageComponent,
'dossier-dictionary': this.dictionaryComponent,
dossierInfo: this.generalInfoComponent,
downloadPackage: this.downloadPackageComponent,
dossierDictionary: this.dictionaryComponent,
members: this.membersComponent,
'dossier-attributes': this.attributesComponent
dossierAttributes: this.attributesComponent
}[this.activeNav];
}
get noPaddingTab(): boolean {
return ['dossier-attributes'].includes(this.activeNav);
return ['dossierAttributes'].includes(this.activeNav);
}
get showHeading(): boolean {
return !['dossier-attributes'].includes(this.activeNav);
return !['dossierAttributes'].includes(this.activeNav);
}
get showSubtitle(): boolean {
return ['dossier-dictionary'].includes(this.activeNav);
return ['dossierDictionary'].includes(this.activeNav);
}
updatedDossier(updatedDossier: DossierWrapper) {

View File

@ -24,6 +24,7 @@ import { ChangeLegalBasisDialogComponent } from '../dialogs/change-legal-basis-d
import { RecategorizeImageDialogComponent } from '../dialogs/recategorize-image-dialog/recategorize-image-dialog.component';
import { DialogService } from '@shared/services/dialog.service';
import { ComponentType } from '@angular/cdk/portal';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
const dialogConfig = {
width: '662px',
@ -201,13 +202,13 @@ export class DossiersDialogService extends DialogService<DialogType> {
const ref = this._dialog.open(ConfirmationDialogComponent, {
...dialogConfig,
data: new ConfirmationDialogInput({
title: 'confirmation-dialog.delete-dossier.title',
title: _('confirmation-dialog.delete-dossier.title'),
titleColor: TitleColors.PRIMARY,
question: 'confirmation-dialog.delete-dossier.question',
// details: 'confirmation-dialog.delete-dossier.details',
confirmationText: 'confirmation-dialog.delete-dossier.confirmation-text',
question: _('confirmation-dialog.delete-dossier.question'),
// details: _('confirmation-dialog.delete-dossier.details'),
confirmationText: _('confirmation-dialog.delete-dossier.confirmation-text'),
requireInput: true,
denyText: 'confirmation-dialog.delete-dossier.deny-text',
denyText: _('confirmation-dialog.delete-dossier.deny-text'),
translateParams: { dossierName: dossier.dossierName, period: period }
})
});
@ -246,8 +247,8 @@ export class DossiersDialogService extends DialogService<DialogType> {
const ref = this._dialog.open(ConfirmationDialogComponent, {
...dialogConfig,
data: new ConfirmationDialogInput({
title: 'confirmation-dialog.assign-file-to-me.title',
question: 'confirmation-dialog.assign-file-to-me.question'
title: _('confirmation-dialog.assign-file-to-me.title'),
question: _('confirmation-dialog.assign-file-to-me.question')
})
});
ref.afterClosed().subscribe(result => {

View File

@ -1,6 +1,7 @@
import { Component, HostListener, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
export type TitleColor = 'default' | 'primary';
@ -20,13 +21,13 @@ export class ConfirmationDialogInput {
translateParams?: Record<string, unknown>;
constructor(options?: ConfirmationDialogInput) {
this.title = options?.title || 'common.confirmation-dialog.title';
this.title = options?.title || _('common.confirmation-dialog.title');
this.titleColor = options?.titleColor || TitleColors.DEFAULT;
this.question = options?.question || 'common.confirmation-dialog.description';
this.question = options?.question || _('common.confirmation-dialog.description');
this.details = options?.details || '';
this.confirmationText = options?.confirmationText || 'common.confirmation-dialog.confirm';
this.confirmationText = options?.confirmationText || _('common.confirmation-dialog.confirm');
this.requireInput = options?.requireInput || false;
this.denyText = options?.denyText || 'common.confirmation-dialog.deny';
this.denyText = options?.denyText || _('common.confirmation-dialog.deny');
this.translateParams = options?.translateParams || {};
}
}

View File

@ -1,4 +1,15 @@
{
"APPROVED": "Approved",
"ERROR": "Re-processing required",
"EXCLUDED": "Excluded",
"FULLREPROCESS": "Processing",
"OCR_PROCESSING": "OCR Processing",
"PROCESSING": "Processing",
"REPROCESS": "Processing",
"UNASSIGNED": "Unassigned",
"UNDER_APPROVAL": "Under Approval",
"UNDER_REVIEW": "Under Review",
"UNPROCESSED": "Unprocessed",
"actions": {
"all": "All",
"none": "None"
@ -55,6 +66,22 @@
"new": "Create Dictionary"
}
},
"add-edit-dossier-attribute": {
"form": {
"label": "Attribute Name",
"label-placeholder": "Enter Name",
"placeholder": "Attribute Placeholder",
"type": "Attribute Type"
},
"save": "Save Attribute",
"title": {
"edit": "Edit {name} Dossier Attribute",
"new": "Add New Dossier Attribute"
},
"error": {
"generic": "Failed to save attribute!"
}
},
"add-edit-dossier-template": {
"form": {
"description": "Description",
@ -86,22 +113,6 @@
"new": "Add New File Attribute"
}
},
"add-edit-dossier-attribute": {
"form": {
"label": "Attribute Name",
"label-placeholder": "Enter Name",
"placeholder": "Attribute Placeholder",
"type": "Attribute Type"
},
"save": "Save Attribute",
"title": {
"edit": "Edit {name} Dossier Attribute",
"new": "Add New Dossier Attribute"
},
"error": {
"generic": "Failed to save attribute!"
}
},
"add-edit-user": {
"actions": {
"cancel": "Cancel",
@ -249,7 +260,6 @@
},
"annotations": "Annotations",
"app-name": "DDA-R",
"APPROVED": "Approved",
"archived": "Archived",
"assign-approver-owner": {
"dialog": {
@ -338,34 +348,6 @@
},
"header": "Edit Redaction Reason"
},
"recategorize-image-dialog": {
"actions": {
"cancel": "Cancel",
"save": "Save Changes"
},
"content": {
"comment": "Comment",
"type": "Select image type",
"type-placeholder": "Select a type..."
},
"header": "Edit Image Type",
"options": {
"image": "Image",
"logo": "Logo",
"signature": "Signature",
"formula": "Formula"
}
},
"reset-password-dialog": {
"header": "Set Temporary Password for {userName}",
"form": {
"password": "Temporary password"
},
"actions": {
"save": "Save",
"cancel": "Cancel"
}
},
"comment": "Comment",
"comments": {
"add-comment": "Enter comment",
@ -406,23 +388,11 @@
"warning": "Warning: this cannot be undone!"
},
"confirm-delete-users": {
"cancel": {
"bulk": "Keep Users",
"single": "Keep User"
},
"delete": {
"bulk": "Delete Users",
"single": "Delete User"
},
"impacted-documents": {
"bulk": "All documents pending review from the users will be impacted",
"single": "All documents pending review from the user will be impacted"
},
"impacted-dossiers": "{dossiersCount} dossiers will be impacted",
"title": {
"bulk": "Delete Users from Workspace",
"single": "Delete User from Workspace"
},
"cancel": "Keep {userCount, plural, =0{} one{User} other{Users}}",
"delete": "Delete {userCount, plural, =0{} one{User} other{Users}}",
"impacted-documents": "All documents pending review from the {userCount, plural, =0{} one{user} other{users}} will be impacted",
"impacted-dossiers": "{dossiersCount} {dossiersCount, plural, =0{dossiers} one{dossier} other{dossiers}} will be impacted",
"title": "Delete {userCount, plural, =0{} one{User} other{Users}} from Workspace",
"toast-error": "Please confirm that you understand the ramifications of your action!",
"warning": "Warning: this cannot be undone!"
},
@ -577,6 +547,39 @@
"save": "Save Document Info",
"title": "Introduce File Attributes"
},
"dossier-attribute-types": {
"DATE": "Date",
"NUMBER": "Number",
"TEXT": "Free Text",
"IMAGE": "Image"
},
"dossier-attributes": "Dossier Attributes",
"dossier-attributes-listing": {
"action": {
"delete": "Delete Attribute",
"edit": "Edit Attribute"
},
"add-new": "New Attribute",
"bulk": {
"delete": "Delete Selected Attributes"
},
"no-match": {
"title": "No attributes match your current filters."
},
"no-data": {
"action": "New Attribute",
"title": "There are no dossier attributes."
},
"search": "Search...",
"table-col-names": {
"label": "Label",
"placeholder": "Placeholder",
"type": "Type"
},
"table-header": {
"title": "{length} dossier attributes"
}
},
"dossier-details": {
"assign-members": "Assign Members",
"collapse": "Hide Details",
@ -850,19 +853,11 @@
"unsaved-changes": "You have unsaved changes. Save or revert before changing the tab."
},
"efsa": "EFSA Approval",
"ERROR": "Re-processing required",
"EXCLUDED": "Excluded",
"file-attribute-types": {
"DATE": "Date",
"NUMBER": "Number",
"TEXT": "Free Text"
},
"dossier-attribute-types": {
"DATE": "Date",
"NUMBER": "Number",
"TEXT": "Free Text",
"IMAGE": "Image"
},
"file-attributes": "File Attributes",
"file-attributes-csv-import": {
"action": {
@ -950,33 +945,6 @@
},
"upload-csv": "Upload File Attributes Configuration"
},
"dossier-attributes": "Dossier Attributes",
"dossier-attributes-listing": {
"action": {
"delete": "Delete Attribute",
"edit": "Edit Attribute"
},
"add-new": "New Attribute",
"bulk": {
"delete": "Delete Selected Attributes"
},
"no-match": {
"title": "No attributes match your current filters."
},
"no-data": {
"action": "New Attribute",
"title": "There are no dossier attributes."
},
"search": "Search...",
"table-col-names": {
"label": "Label",
"placeholder": "Placeholder",
"type": "Type"
},
"table-header": {
"title": "{length} dossier attributes"
}
},
"file-preview": {
"assign-me": "Assign to me",
"assign-reviewer": "Assign Reviewer",
@ -1071,7 +1039,6 @@
"status": "Status"
},
"finished": "Finished",
"FULLREPROCESS": "Processing",
"hint": "Hint",
"initials-avatar": {
"unassigned": "Unassigned",
@ -1148,7 +1115,6 @@
"tomorrow": "Tomorrow",
"yesterday": "Yesterday"
},
"OCR_PROCESSING": "OCR Processing",
"overwrite-files-dialog": {
"options": {
"cancel": "Cancel all uploads",
@ -1173,8 +1139,25 @@
},
"pending-analysis": "Pending Re-Analysis",
"pending-changes-guard": "WARNING: You have unsaved changes. Press Cancel to go back and save these changes, or OK to lose these changes.",
"PROCESSING": "Processing",
"readonly": "Read only",
"recategorize-image-dialog": {
"actions": {
"cancel": "Cancel",
"save": "Save Changes"
},
"content": {
"comment": "Comment",
"type": "Select image type",
"type-placeholder": "Select a type..."
},
"header": "Edit Image Type",
"options": {
"image": "Image",
"logo": "Logo",
"signature": "Signature",
"formula": "Formula"
}
},
"redaction": "Redaction",
"remove-annotations-dialog": {
"confirm": "Yes, proceed and remove!",
@ -1207,8 +1190,17 @@
"title": "Reports",
"upload-document": "Upload a Document"
},
"REPROCESS": "Processing",
"reset-filters": "Reset Filters",
"reset-password-dialog": {
"header": "Set Temporary Password for {userName}",
"form": {
"password": "Temporary password"
},
"actions": {
"save": "Save",
"cancel": "Cancel"
}
},
"roles": {
"INACTIVE": "Inactive",
"MANAGER_ADMIN": "Manager & Admin",
@ -1284,6 +1276,39 @@
},
"title": "Configure SMTP Account"
},
"sorting": {
"alphabetically": "Alphabetically",
"custom": "Custom",
"number-of-analyses": "Number of analyses",
"number-of-pages": "Number of pages",
"oldest": "Oldest",
"recent": "Recent"
},
"submitted": "Submitted",
"suggestion": "Suggestion for redaction",
"time": {
"no-time-left": "Time to restore already passed",
"less-than-an-hour": "< 1 hour",
"hour": "hour",
"hours": "hours",
"day": "day",
"days": "days"
},
"top-bar": {
"navigation-items": {
"back": "Back",
"dossiers": "Active Dossier",
"my-account": {
"children": {
"admin": "Settings",
"downloads": "My Downloads",
"my-profile": "My Profile",
"trash": "Trash",
"logout": "Logout"
}
}
}
},
"trash": {
"label": "Trash",
"table-header": {
@ -1312,36 +1337,7 @@
"title": "No dossiers match your current filters."
}
},
"sorting": {
"alphabetically": "Alphabetically",
"custom": "Custom",
"number-of-analyses": "Number of analyses",
"number-of-pages": "Number of pages",
"oldest": "Oldest",
"recent": "Recent"
},
"submitted": "Submitted",
"suggestion": "Suggestion for redaction",
"top-bar": {
"navigation-items": {
"back": "Back",
"dossiers": "Active Dossier",
"my-account": {
"children": {
"admin": "Settings",
"downloads": "My Downloads",
"my-profile": "My Profile",
"trash": "Trash",
"logout": "Logout"
}
}
}
},
"type": "Type",
"UNASSIGNED": "Unassigned",
"UNDER_APPROVAL": "Under Approval",
"UNDER_REVIEW": "Under Review",
"UNPROCESSED": "Unprocessed",
"upload-status": {
"dialog": {
"actions": {
@ -1418,13 +1414,5 @@
"text-placeholder": "Enter text"
},
"title": "Watermark"
},
"time": {
"no-time-left": "Time to restore already passed",
"less-than-an-hour": "< 1 hour",
"hour": "hour",
"hours": "hours",
"day": "day",
"days": "days"
}
}