mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
Merge pull request #1208 from Alfresco/dev-mvitale-384-style
Document list - Create Folder Docs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<alfresco-document-menu-action *ngIf="contentMenuActions"
|
||||
[currentFolderPath]="currentFolderPath"
|
||||
(onSuccess)="reload()">
|
||||
<alfresco-document-menu-action *ngIf="creationMenuActions"
|
||||
[currentFolderPath]="currentFolderPath"
|
||||
(success)="onActionMenuSuccess($event)"
|
||||
(error)="onActionMenuError($event)">
|
||||
</alfresco-document-menu-action>
|
||||
<alfresco-datatable
|
||||
[data]="data"
|
||||
|
@@ -92,10 +92,10 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
||||
contentActions: boolean = false;
|
||||
|
||||
@Input()
|
||||
contentMenuActions: boolean = true;
|
||||
contextMenuActions: boolean = false;
|
||||
|
||||
@Input()
|
||||
contextMenuActions: boolean = false;
|
||||
creationMenuActions: boolean = true;
|
||||
|
||||
@Input()
|
||||
pageSize: number = DocumentList.DEFAULT_PAGE_SIZE;
|
||||
@@ -126,6 +126,9 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
||||
@Output()
|
||||
preview: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
success: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@@ -472,4 +475,13 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
||||
this.executeContentAction(node, action);
|
||||
}
|
||||
}
|
||||
|
||||
onActionMenuError(event) {
|
||||
this.error.emit(event);
|
||||
}
|
||||
|
||||
onActionMenuSuccess(event) {
|
||||
this.reload();
|
||||
this.success.emit(event);
|
||||
}
|
||||
}
|
||||
|
@@ -71,4 +71,15 @@
|
||||
|
||||
.mdl-menu__item-icon {
|
||||
margin-right: 32px;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.mdl-menu--bottom-left {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.mdl-menu__text {
|
||||
float: right;
|
||||
margin-right: 22px;
|
||||
}
|
@@ -1,22 +1,21 @@
|
||||
<div class="container">
|
||||
<div class="action">
|
||||
<button id="actions" class="mdl-button mdl-js-button mdl-button--raised">
|
||||
<i class="material-icons">add</i> Create...
|
||||
<i class="material-icons">add</i> {{ 'BUTTON.ACTION_CREATE' | translate }}
|
||||
</button>
|
||||
<ul alfresco-mdl-menu class="mdl-menu--bottom-left"
|
||||
[attr.for]="'actions'">
|
||||
<li class="mdl-menu__item"
|
||||
(click)="showDialog()" >
|
||||
<i class="material-icons mdl-menu__item-icon">folder</i>
|
||||
New Folder
|
||||
<span class="mdl-menu__text">{{ 'BUTTON.ACTION_NEW_FOLDER' | translate }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>{{message}}</div>
|
||||
</div>
|
||||
|
||||
<dialog class="mdl-dialog" #dialog>
|
||||
<h4 class="mdl-dialog__title">New folder</h4>
|
||||
<h4 class="mdl-dialog__title">{{ 'BUTTON.ACTION_NEW_FOLDER' | translate }}</h4>
|
||||
<div class="mdl-dialog__content">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input
|
||||
@@ -30,7 +29,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="mdl-dialog__actions">
|
||||
<button type="button" (click)="createFolder(name.value)" class="mdl-button">Create</button>
|
||||
<button type="button" (click)="cancel()" class="mdl-button close">Cancel</button>
|
||||
<button type="button" (click)="createFolder(name.value)" class="mdl-button">{{ 'BUTTON.CREATE' | translate }}</button>
|
||||
<button type="button" (click)="cancel()" class="mdl-button close">{{ 'BUTTON.CANCEL' | translate }}</button>
|
||||
</div>
|
||||
</dialog>
|
@@ -43,10 +43,10 @@ export class DocumentMenuAction implements OnInit {
|
||||
currentFolderPath: string;
|
||||
|
||||
@Output()
|
||||
onSuccess = new EventEmitter();
|
||||
success = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
onError = new EventEmitter();
|
||||
error = new EventEmitter();
|
||||
|
||||
@ViewChild('dialog')
|
||||
dialog: any;
|
||||
@@ -73,15 +73,16 @@ export class DocumentMenuAction implements OnInit {
|
||||
res => {
|
||||
let relativeDir = this.currentFolderPath;
|
||||
console.log(relativeDir);
|
||||
this.onSuccess.emit({value: relativeDir});
|
||||
this.success.emit({value: relativeDir});
|
||||
},
|
||||
error => {
|
||||
let errorMessagePlaceholder = this.getErrorMessage(error.response);
|
||||
if (errorMessagePlaceholder) {
|
||||
this.onError.emit({value: errorMessagePlaceholder});
|
||||
this.message = this.formatString(errorMessagePlaceholder, [name]);
|
||||
this.error.emit({message: this.message});
|
||||
console.log(this.message);
|
||||
} else {
|
||||
this.error.emit(error);
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user