mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-971] Create task/process attachment should show the new button (#2069)
* Remove the drag and drop Change the design button Fix the Event with the name inside the Readme * Fix unit test * Rollback id button
This commit is contained in:
committed by
Eugenio Romano
parent
50fef106a8
commit
8a509e3c31
@@ -1,19 +1,5 @@
|
||||
.upload-attachment-container {
|
||||
border: 1px solid rgb(224, 224, 224);
|
||||
background: #fff;
|
||||
text-align: left;
|
||||
border-top: none;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
.adf-create-attachment {
|
||||
display: inline-block;
|
||||
line-height: 0px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.drag-area {
|
||||
border: 1px solid #eee;
|
||||
padding: 100px 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.upload-attachment-container button {
|
||||
color: rgb(253, 145, 0);
|
||||
opacity: 0.64;
|
||||
}
|
@@ -1,17 +1,12 @@
|
||||
<div class="upload-attachment-container">
|
||||
<div class="drag-area"
|
||||
id="add_new_process_content_area"
|
||||
(upload-files)="onFileUpload($event)"
|
||||
mode="['click', 'drop']"
|
||||
[adf-upload]="true">
|
||||
{{ 'DETAILS.BUTTON.DRAG-ATTACHMENT' | translate }}
|
||||
</div>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised"
|
||||
id="add_new_process_content_button"
|
||||
[adf-upload]="true"
|
||||
mode="['click']"
|
||||
[multiple]="true"
|
||||
(upload-files)="onFileUpload($event)">
|
||||
{{ 'DETAILS.BUTTON.UPLOAD-ATTACHMENT' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
id="add_new_process_content_button"
|
||||
md-button
|
||||
md-raised-button
|
||||
md-icon-button
|
||||
class="adf-create-attachment"
|
||||
[adf-upload]="true"
|
||||
mode="['click']"
|
||||
[multiple]="true"
|
||||
(upload-files)="onFileUpload($event)">
|
||||
<md-icon>add</md-icon>
|
||||
</button>
|
||||
|
@@ -98,7 +98,7 @@ describe('Activiti Process Create Attachment', () => {
|
||||
});
|
||||
|
||||
it('should emit content created event when the file is uploaded', async(() => {
|
||||
component.contentCreated.subscribe((res) => {
|
||||
component.success.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res).not.toBeNull();
|
||||
expect(res.id).toBe(9999);
|
||||
@@ -113,34 +113,12 @@ describe('Activiti Process Create Attachment', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should allow user to drag&drop files', async(() => {
|
||||
let dragArea: HTMLElement = <HTMLElement> element.querySelector('#add_new_process_content_area');
|
||||
expect(dragArea).toBeDefined();
|
||||
expect(dragArea).not.toBeNull();
|
||||
|
||||
component.contentCreated.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res).not.toBeNull();
|
||||
expect(res.id).toBe(9999);
|
||||
});
|
||||
|
||||
let dropEvent = new CustomEvent('upload-files', customEvent);
|
||||
dragArea.dispatchEvent(dropEvent);
|
||||
fixture.detectChanges();
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeUploadResponse)
|
||||
});
|
||||
}));
|
||||
|
||||
it('should allow user to upload files via button', async(() => {
|
||||
let buttonUpload: HTMLElement = <HTMLElement> element.querySelector('#add_new_process_content_button');
|
||||
expect(buttonUpload).toBeDefined();
|
||||
expect(buttonUpload).not.toBeNull();
|
||||
|
||||
component.contentCreated.subscribe((res) => {
|
||||
component.success.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res).not.toBeNull();
|
||||
expect(res.id).toBe(9999);
|
||||
|
@@ -30,10 +30,10 @@ export class ActivitiCreateProcessAttachmentComponent implements OnChanges {
|
||||
processInstanceId: string;
|
||||
|
||||
@Output()
|
||||
creationError: EventEmitter<any> = new EventEmitter<any>();
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
@Output()
|
||||
contentCreated: EventEmitter<any> = new EventEmitter<any>();
|
||||
success: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
constructor(private translateService: AlfrescoTranslationService,
|
||||
private activitiContentService: ActivitiContentService) {
|
||||
@@ -59,10 +59,10 @@ export class ActivitiCreateProcessAttachmentComponent implements OnChanges {
|
||||
};
|
||||
this.activitiContentService.createProcessRelatedContent(this.processInstanceId, file, opts).subscribe(
|
||||
(res) => {
|
||||
this.contentCreated.emit(res);
|
||||
this.success.emit(res);
|
||||
},
|
||||
(err) => {
|
||||
this.creationError.emit(err);
|
||||
this.error.emit(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user