[ADF-2561] add showComments toggle on demo-shell (#3143)

This commit is contained in:
Suzana Dirla
2018-04-05 14:05:58 +03:00
committed by Denys Vuika
parent 9b3e153b83
commit c7507c0c31
5 changed files with 17 additions and 3 deletions

View File

@@ -62,6 +62,7 @@
"DESCRIPTION_UPLOAD" : "Enable upload", "DESCRIPTION_UPLOAD" : "Enable upload",
"ENABLE_INFINITE_SCROLL":"Enable Infinite Scrolling", "ENABLE_INFINITE_SCROLL":"Enable Infinite Scrolling",
"MULTISELECT_DESCRIPTION" : "Use Cmd (Mac) or Ctrl (Windows) to toggle selection of multiple items", "MULTISELECT_DESCRIPTION" : "Use Cmd (Mac) or Ctrl (Windows) to toggle selection of multiple items",
"SHOW_VERSION_COMMENTS" : "Show comments on versions",
"RECENT" : { "RECENT" : {
"EMPTY_STATE": { "EMPTY_STATE": {
"TITLE": "Recent is empty" "TITLE": "Recent is empty"

View File

@@ -352,7 +352,8 @@
<ng-container *ngIf="hasOneFileSelected();else choose_document_template"> <ng-container *ngIf="hasOneFileSelected();else choose_document_template">
<ng-container *ngIf="userHasPermissionToManageVersions(); else no_permission_to_versions"> <ng-container *ngIf="userHasPermissionToManageVersions(); else no_permission_to_versions">
<adf-version-manager <adf-version-manager
[node]="documentList.selection[0].entry"> [node]="documentList.selection[0].entry"
[showComments]="showVersionComments">
</adf-version-manager> </adf-version-manager>
</ng-container> </ng-container>
</ng-container> </ng-container>
@@ -438,6 +439,12 @@
</mat-slide-toggle> </mat-slide-toggle>
</section> </section>
<section>
<mat-slide-toggle [color]="'primary'" [(ngModel)]="showVersionComments">{{'DOCUMENT_LIST.SHOW_VERSION_COMMENTS' |
translate}}
</mat-slide-toggle>
</section>
<h5>Upload</h5> <h5>Upload</h5>
<section *ngIf="acceptedFilesTypeShow"> <section *ngIf="acceptedFilesTypeShow">
<mat-form-field floatPlaceholder="float"> <mat-form-field floatPlaceholder="float">

View File

@@ -96,6 +96,9 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
maxSizeShow = false; maxSizeShow = false;
@Input()
showVersionComments = true;
@Input() @Input()
versioning = false; versioning = false;
@@ -358,10 +361,11 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
onManageVersions(event) { onManageVersions(event) {
const contentEntry = event.value.entry; const contentEntry = event.value.entry;
const showComments = this.showVersionComments;
if (this.contentService.hasPermission(contentEntry, 'update')) { if (this.contentService.hasPermission(contentEntry, 'update')) {
this.dialog.open(VersionManagerDialogAdapterComponent, { this.dialog.open(VersionManagerDialogAdapterComponent, {
data: { contentEntry }, data: { contentEntry, showComments },
panelClass: 'adf-version-manager-dialog', panelClass: 'adf-version-manager-dialog',
width: '630px' width: '630px'
}); });

View File

@@ -1,6 +1,6 @@
<header mat-dialog-title>{{'VERSION.DIALOG.TITLE' | translate}}</header> <header mat-dialog-title>{{'VERSION.DIALOG.TITLE' | translate}}</header>
<section mat-dialog-content> <section mat-dialog-content>
<adf-version-manager [node]="contentEntry" (uploadError)="uploadError($event)"></adf-version-manager> <adf-version-manager [node]="contentEntry" [showComments]="showComments" (uploadError)="uploadError($event)"></adf-version-manager>
</section> </section>
<footer mat-dialog-actions fxLayout="row" fxLayoutAlign="end center"> <footer mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
<button mat-button (click)="close()">{{'VERSION.DIALOG.CLOSE' | translate}}</button> <button mat-button (click)="close()">{{'VERSION.DIALOG.CLOSE' | translate}}</button>

View File

@@ -27,11 +27,13 @@ import { MatSnackBar } from '@angular/material';
export class VersionManagerDialogAdapterComponent { export class VersionManagerDialogAdapterComponent {
public contentEntry: MinimalNodeEntryEntity; public contentEntry: MinimalNodeEntryEntity;
showComments = true;
constructor(@Inject(MAT_DIALOG_DATA) data: any, constructor(@Inject(MAT_DIALOG_DATA) data: any,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private containingDialog?: MatDialogRef<VersionManagerDialogAdapterComponent>) { private containingDialog?: MatDialogRef<VersionManagerDialogAdapterComponent>) {
this.contentEntry = data.contentEntry; this.contentEntry = data.contentEntry;
this.showComments = data.hasOwnProperty('showComments') ? data.showComments : this.showComments;
} }
uploadError(errorMessage: string) { uploadError(errorMessage: string) {