This commit is contained in:
mauriziovitale84
2016-05-11 14:02:11 +01:00
parent 6efcf3ca5b
commit 79c12f31e4
10 changed files with 90 additions and 21 deletions

View File

@@ -1,2 +1,15 @@
{
}
"FILE_UPLOAD": {
"BUTTON": {
"UPLOAD_FILE": "Upload file",
"UPLOAD_FOLDER": "Upload folder"
},
"MESSAGES": {
"COMPLETED": "uploads complete",
"PROGRESS": "Upload in progress..."
},
"ACTION": {
"UNDO": "Undo"
}
}
}

View File

@@ -1,2 +1,15 @@
{
"FILE_UPLOAD": {
"BUTTON": {
"UPLOAD_FILE": "Carica un file",
"UPLOAD_FOLDER": "Carica una cartella"
},
"MESSAGES": {
"COMPLETED": "caricamento completato",
"PROGRESS": "caricamento in corso..."
},
"ACTION": {
"UNDO": "Annulla"
}
}
}

View File

@@ -1,7 +1,7 @@
<div class="file-dialog" [ngClass]="{show: _isDialogActive}">
<div class="header">
<div class="title">
{{filesUploadingList.length}} uploads complete
{{filesUploadingList.length}} {{'FILE_UPLOAD.MESSAGES.COMPLETED' | translate}}
</div>
<div class="buttons">
<div class="minimize-button" [ngClass]="{active: _isDialogMinimized}" (click)="toggleDialogMinimize($event)">

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['angular2/core', './file-uploading-list.component'], function(exports_1, context_1) {
System.register(['angular2/core', './file-uploading-list.component', 'ng2-translate/ng2-translate'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -26,7 +26,7 @@ System.register(['angular2/core', './file-uploading-list.component'], function(e
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1, file_uploading_list_component_1;
var core_1, file_uploading_list_component_1, ng2_translate_1;
var FileUploadingDialogComponent;
return {
setters:[
@@ -35,6 +35,9 @@ System.register(['angular2/core', './file-uploading-list.component'], function(e
},
function (file_uploading_list_component_1_1) {
file_uploading_list_component_1 = file_uploading_list_component_1_1;
},
function (ng2_translate_1_1) {
ng2_translate_1 = ng2_translate_1_1;
}],
execute: function() {
/**
@@ -84,7 +87,8 @@ System.register(['angular2/core', './file-uploading-list.component'], function(e
directives: [file_uploading_list_component_1.FileUploadingListComponent],
templateUrl: './file-uploading-dialog.component.html',
styleUrls: ['./file-uploading-dialog.component.css'],
host: { '[class.dialog-show]': 'toggleShowDialog' }
host: { '[class.dialog-show]': 'toggleShowDialog' },
pipes: [ng2_translate_1.TranslatePipe]
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], FileUploadingDialogComponent);

View File

@@ -1 +1 @@
{"version":3,"file":"file-uploading-dialog.component.js","sourceRoot":"","sources":["file-uploading-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YASH;;;;;;;;;;eAUG;YASH;gBASI,sCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAJzB,oBAAe,GAAY,KAAK,CAAC;oBAEjC,uBAAkB,GAAY,KAAK,CAAC;oBAGxC,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED;;mBAEG;gBACH,uDAAgB,GAAhB,UAAiB,MAAM;oBACnB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACjD,CAAC;gBAED;;mBAEG;gBACH,iDAAU,GAAV;oBACI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED;;mBAEG;gBACH,2DAAoB,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBACvD,CAAC;gBA9BD;oBAAC,YAAK,EAAE;;wFAAA;gBAVZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,0DAA0B,CAAC;wBACxC,WAAW,EAAE,wCAAwC;wBACrD,SAAS,EAAE,CAAC,uCAAuC,CAAC;wBACpD,IAAI,EAAE,EAAC,qBAAqB,EAAE,kBAAkB,EAAC;qBACpD,CAAC;;gDAAA;gBAkCF,mCAAC;YAAD,CAAC,AAjCD,IAiCC;YAjCD,uEAiCC,CAAA"}
{"version":3,"file":"file-uploading-dialog.component.js","sourceRoot":"","sources":["file-uploading-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH;;;;;;;;;;eAUG;YAUH;gBASI,sCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAJzB,oBAAe,GAAY,KAAK,CAAC;oBAEjC,uBAAkB,GAAY,KAAK,CAAC;oBAGxC,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED;;mBAEG;gBACH,uDAAgB,GAAhB,UAAiB,MAAM;oBACnB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACjD,CAAC;gBAED;;mBAEG;gBACH,iDAAU,GAAV;oBACI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED;;mBAEG;gBACH,2DAAoB,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBACvD,CAAC;gBA9BD;oBAAC,YAAK,EAAE;;wFAAA;gBAXZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,0DAA0B,CAAC;wBACxC,WAAW,EAAE,wCAAwC;wBACrD,SAAS,EAAE,CAAC,uCAAuC,CAAC;wBACpD,IAAI,EAAE,EAAC,qBAAqB,EAAE,kBAAkB,EAAC;wBACjD,KAAK,EAAE,CAAC,6BAAa,CAAC;qBACzB,CAAC;;gDAAA;gBAkCF,mCAAC;YAAD,CAAC,AAjCD,IAiCC;YAjCD,uEAiCC,CAAA"}

View File

@@ -19,6 +19,7 @@
import {Component, ElementRef, Input} from 'angular2/core';
import {FileModel} from '../models/file.model';
import {FileUploadingListComponent} from './file-uploading-list.component';
import {TranslateService, TranslatePipe} from 'ng2-translate/ng2-translate';
declare let __moduleName: string;
@@ -39,7 +40,8 @@ declare let __moduleName: string;
directives: [FileUploadingListComponent],
templateUrl: './file-uploading-dialog.component.html',
styleUrls: ['./file-uploading-dialog.component.css'],
host: {'[class.dialog-show]': 'toggleShowDialog'}
host: {'[class.dialog-show]': 'toggleShowDialog'},
pipes: [TranslatePipe]
})
export class FileUploadingDialogComponent {

View File

@@ -1,7 +1,7 @@
<form>
<!--Files Upload-->
<div *ngIf="!uploadFolders" class="mdl-button mdl-js-button mdl-button--raised mdl-button--file">
<i class="material-icons">file_upload</i> Upload File
<i class="material-icons">file_upload</i> {{'FILE_UPLOAD.BUTTON.UPLOAD_FILE' | translate}}
<!--Multiple Files Upload-->
<span *ngIf="multipleFiles">
@@ -23,7 +23,7 @@
<!--Folders Upload-->
<div *ngIf="uploadFolders" class="mdl-button mdl-js-button mdl-button--raised mdl-button--file">
<i class="material-icons">file_upload</i> Upload Folder
<i class="material-icons">file_upload</i> {{'FILE_UPLOAD.BUTTON.UPLOAD_FOLDER' | translate}}
<input id="uploadFolder" type="file" name="uploadFiles"
(change)="onFilesAdded($event)"
multiple="multiple"

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['angular2/core', '../services/upload.service', './file-uploading-dialog.component'], function(exports_1, context_1) {
System.register(['angular2/core', '../services/upload.service', './file-uploading-dialog.component', 'ng2-translate/ng2-translate'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -26,7 +26,7 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1, upload_service_1, file_uploading_dialog_component_1;
var core_1, upload_service_1, file_uploading_dialog_component_1, ng2_translate_1;
var UploadButtonComponent;
return {
setters:[
@@ -38,6 +38,9 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
},
function (file_uploading_dialog_component_1_1) {
file_uploading_dialog_component_1 = file_uploading_dialog_component_1_1;
},
function (ng2_translate_1_1) {
ng2_translate_1 = ng2_translate_1_1;
}],
execute: function() {
/**
@@ -60,11 +63,11 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
* @returns {UploadDragAreaComponent} .
*/
UploadButtonComponent = (function () {
function UploadButtonComponent(el) {
function UploadButtonComponent(el, translate) {
this.el = el;
this.showUploadDialog = true;
this.showUdoNotificationBar = true;
this.uploadFolders = false;
this.uploadFolders = true;
this.multipleFiles = false;
this.acceptedFilesType = '*';
this.filesUploadingList = [];
@@ -80,6 +83,7 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
containerid: 'documentLibrary'
}
});
this.translationInit(translate);
}
/**
* Method called when files are dropped in the drag area.
@@ -109,14 +113,14 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
componentHandler.upgradeAllRegistered();
}
this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({
message: 'Upload in progress...',
message: this.translate.get('FILE_UPLOAD.MESSAGES.PROGRESS').value,
timeout: 5000,
actionHandler: function () {
latestFilesAdded.forEach(function (uploadingFileModel) {
uploadingFileModel.setAbort();
});
},
actionText: 'Undo'
actionText: this.translate.get('FILE_UPLOAD.ACTION.UNDO').value
});
};
/**
@@ -125,6 +129,17 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
UploadButtonComponent.prototype._showDialog = function () {
this.fileUploadingDialogComponent.showDialog();
};
/**
* Initial configuration for Multi language
* @param translate
*/
UploadButtonComponent.prototype.translationInit = function (translate) {
this.translate = translate;
var userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
this.translate.setDefaultLang(userLang);
this.translate.use(userLang);
};
__decorate([
core_1.ViewChild('undoNotificationBar'),
__metadata('design:type', Object)
@@ -160,8 +175,9 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
directives: [file_uploading_dialog_component_1.FileUploadingDialogComponent],
templateUrl: './upload-button.component.html',
styleUrls: ['./upload-button.component.css'],
pipes: [ng2_translate_1.TranslatePipe]
}),
__metadata('design:paramtypes', [core_1.ElementRef])
__metadata('design:paramtypes', [core_1.ElementRef, ng2_translate_1.TranslateService])
], UploadButtonComponent);
return UploadButtonComponent;
}());

View File

@@ -1 +1 @@
{"version":3,"file":"upload-button.component.js","sourceRoot":"","sources":["upload-button.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YAWH;;;;;;;;;;;;;;;;;;eAkBG;YAQH;gBA2BI,+BAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAhBjC,qBAAgB,GAAY,IAAI,CAAC;oBAGjC,2BAAsB,GAAY,IAAI,CAAC;oBAGvC,kBAAa,GAAY,KAAK,CAAC;oBAG/B,kBAAa,GAAY,KAAK,CAAC;oBAG/B,sBAAiB,GAAW,GAAG,CAAC;oBAEhC,uBAAkB,GAAiB,EAAE,CAAC;oBAGlC,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;oBAE/C,IAAI,CAAC,gBAAgB,GAAG,IAAI,8BAAa,CAAC;wBACtC,GAAG,EAAE,wDAAwD;wBAC7D,eAAe,EAAE,IAAI;wBACrB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC;wBAC9B,eAAe,EAAE,OAAO;wBACxB,SAAS,EAAE,UAAU;wBACrB,UAAU,EAAE;4BACR,MAAM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,CAAC,6BAAa,CAAC;qBACzB,CAAC;;yCAAA;gBA8GF,4BAAC;YAAD,CAAC,AA7GD,IA6GC;YA7GD,yDA6GC,CAAA"}

View File

@@ -20,6 +20,7 @@ import {Component, ViewChild, ElementRef, Input} from 'angular2/core';
import {UploadService} from '../services/upload.service';
import {FileModel} from '../models/file.model';
import {FileUploadingDialogComponent} from './file-uploading-dialog.component';
import {TranslateService, TranslatePipe} from 'ng2-translate/ng2-translate';
declare let componentHandler;
declare let __moduleName: string;
@@ -49,6 +50,7 @@ declare let __moduleName: string;
directives: [FileUploadingDialogComponent],
templateUrl: './upload-button.component.html',
styleUrls: ['./upload-button.component.css'],
pipes: [TranslatePipe]
})
export class UploadButtonComponent {
@@ -67,7 +69,7 @@ export class UploadButtonComponent {
showUdoNotificationBar: boolean = true;
@Input()
uploadFolders: boolean = false;
uploadFolders: boolean = true;
@Input()
multipleFiles: boolean = false;
@@ -77,7 +79,10 @@ export class UploadButtonComponent {
filesUploadingList: FileModel [] = [];
constructor(public el: ElementRef) {
translate: TranslateService;
constructor(public el: ElementRef,
translate: TranslateService) {
console.log('UploadComponent constructor', el);
this._uploaderService = new UploadService({
@@ -91,6 +96,8 @@ export class UploadButtonComponent {
containerid: 'documentLibrary'
}
});
this.translationInit(translate);
}
/**
@@ -123,14 +130,14 @@ export class UploadButtonComponent {
}
this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({
message: 'Upload in progress...',
message: this.translate.get('FILE_UPLOAD.MESSAGES.PROGRESS').value,
timeout: 5000,
actionHandler: function () {
latestFilesAdded.forEach((uploadingFileModel) => {
uploadingFileModel.setAbort();
});
},
actionText: 'Undo'
actionText: this.translate.get('FILE_UPLOAD.ACTION.UNDO').value
});
}
@@ -140,4 +147,18 @@ export class UploadButtonComponent {
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
/**
* Initial configuration for Multi language
* @param translate
*/
translationInit(translate: TranslateService) {
this.translate = translate;
let userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
this.translate.setDefaultLang(userLang);
this.translate.use(userLang);
}
}