Skip to content
Snippets Groups Projects
Unverified Commit ad77640f authored by Tim Donohue's avatar Tim Donohue Committed by GitHub
Browse files

Merge pull request #512 from atmire/Community-and-Collection-logos

Community and collection logos
parents 4b67dbf1 42d12a83
No related branches found
No related tags found
No related merge requests found
......@@ -19,23 +19,24 @@
(fileOver)="fileOverBase($event)"
class="well ds-base-drop-zone mt-1 mb-3 text-muted">
<p class="text-center m-0 p-0 d-flex justify-content-center align-items-center" *ngIf="uploader?.queue?.length === 0">
<span><i class="fas fa-cloud-upload" aria-hidden="true"></i> {{dropMsg | translate}} {{'uploader.or' | translate}}
<label class="btn btn-link m-0 p-0">
<input class="d-none" type="file" ng2FileSelect [uploader]="uploader" multiple />
{{'uploader.browse' | translate}}
</label>
</span>
<span><i class="fas fa-cloud-upload" aria-hidden="true"></i> {{dropMsg | translate}} {{'uploader.or' | translate}}</span>
<label class="btn btn-link m-0 p-0 ml-1">
<input class="d-none" type="file" ng2FileSelect [uploader]="uploader" multiple />
{{'uploader.browse' | translate}}
</label>
</p>
<div *ngIf="(isOverBaseDropZone | async) || uploader?.queue?.length !== 0">
<div class="m-1">
<div class="upload-item-top">
<span class="filename">{{'uploader.queue-length' | translate}}: {{ uploader?.queue?.length }} | {{ uploader?.queue[0]?.file.name }}</span>
<span class="filename">
<span *ngIf="!uploader.options.disableMultipart">{{'uploader.queue-length' | translate}}: {{ uploader?.queue?.length }} | </span>{{ uploader?.queue[0]?.file.name }}
</span>
<div class="btn-group btn-group-sm float-right" role="group">
<button type="button" class="btn btn-danger" (click)="uploader.clearQueue()" [disabled]="!uploader.queue.length">
<i class="fas fa-trash" aria-hidden="true"></i>
</button>
</div>
<span *ngIf="uploader.progress < 100" class="float-right mr-3">{{ uploader.progress }}%</span>
<span *ngIf="uploader.progress < 100 && !(uploader.progress === 0 && !uploader.options.autoUpload)" class="float-right mr-3">{{ uploader.progress }}%</span>
<span *ngIf="uploader.progress === 100" class="float-right mr-3">{{'uploader.processing' | translate}}...</span>
</div>
<div class="ds-base-drop-zone-progress clearfix mt-2">
......
......@@ -64,12 +64,12 @@ describe('Chips component', () => {
template: ``
})
class TestComponent {
public uploadFilesOptions: UploaderOptions = {
public uploadFilesOptions: UploaderOptions = Object.assign(new UploaderOptions(), {
url: 'http://test',
authToken: null,
disableMultipart: false,
itemAlias: null
};
});
/* tslint:disable:no-empty */
public onBeforeUpload = () => {
......
......@@ -95,7 +95,8 @@ export class UploaderComponent {
disableMultipart: this.uploadFilesOptions.disableMultipart,
itemAlias: this.uploadFilesOptions.itemAlias,
removeAfterUpload: true,
autoUpload: true
autoUpload: this.uploadFilesOptions.autoUpload,
method: this.uploadFilesOptions.method
});
if (isUndefined(this.enableDragOverDocument)) {
......@@ -117,7 +118,10 @@ export class UploaderComponent {
if (isUndefined(this.onBeforeUpload)) {
this.onBeforeUpload = () => {return};
}
this.uploader.onBeforeUploadItem = () => {
this.uploader.onBeforeUploadItem = (item) => {
if (item.url !== this.uploader.options.url) {
item.url = this.uploader.options.url;
}
this.onBeforeUpload();
this.isOverDocumentDropZone = observableOf(false);
......
......@@ -77,12 +77,7 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
* The uploader configuration options
* @type {UploaderOptions}
*/
public uploadFilesOptions: UploaderOptions = {
url: '',
authToken: null,
disableMultipart: false,
itemAlias: null
};
public uploadFilesOptions: UploaderOptions = new UploaderOptions();
/**
* A boolean representing if component is active
......
......@@ -28,6 +28,7 @@ import { SubmissionJsonPatchOperationsServiceStub } from '../../../shared/testin
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
import { SharedModule } from '../../../shared/shared.module';
import { createTestComponent } from '../../../shared/testing/utils';
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
describe('SubmissionUploadFilesComponent Component', () => {
......@@ -112,12 +113,12 @@ describe('SubmissionUploadFilesComponent Component', () => {
comp.submissionId = submissionId;
comp.collectionId = collectionId;
comp.sectionId = 'upload';
comp.uploadFilesOptions = {
comp.uploadFilesOptions = Object.assign(new UploaderOptions(),{
url: '',
authToken: null,
disableMultipart: false,
itemAlias: null
};
});
});
......@@ -208,11 +209,11 @@ class TestComponent {
submissionId = mockSubmissionId;
collectionId = mockSubmissionCollectionId;
sectionId = 'upload';
uploadFilesOptions = {
uploadFilesOptions = Object.assign(new UploaderOptions(), {
url: '',
authToken: null,
disableMultipart: false,
itemAlias: null
};
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment