diff --git a/client/components/documentList/documentList.controller.js b/client/components/documentList/documentList.controller.js index caf60c6..cc1b1b4 100644 --- a/client/components/documentList/documentList.controller.js +++ b/client/components/documentList/documentList.controller.js @@ -1,16 +1,15 @@ 'use strict'; angular.module('manticoreApp') .controller('DocumentListCtrl', function ($scope, $http) { $scope.displayedDocuments = []; function update() { - console.log('here'); $http.get('/api/documents').success(function (documents) { $scope.documents = documents; }); } $scope.$on('documentsUploaded', update); update(); }); diff --git a/client/components/import/import.controller.js b/client/components/import/import.controller.js index d4a91b3..f031ec9 100644 --- a/client/components/import/import.controller.js +++ b/client/components/import/import.controller.js @@ -1,35 +1,36 @@ 'use strict'; angular.module('manticoreApp') .controller('ImportCtrl', function ($scope, $rootScope, FileUploader, Auth) { var uploader = new FileUploader({ url: '/api/documents/upload', headers: { 'Authorization': 'Bearer ' + Auth.getToken() }, - removeAfterUpload: true, + removeAfterUpload: false, autoUpload: true, onCompleteAll: function () { // Wait a little before firing this event, as the upload may not // be accessible from MongoDB immediately window.setTimeout(function () { $rootScope.$broadcast('documentsUploaded'); + uploader.clearQueue(); }, 1000); } }); uploader.filters.push({ name: 'sizeFilter', fn: function (item) { return item.size <= 10485760; // 10 Megabytes } }); uploader.filters.push({ name: 'typeFilter', fn: function (item) { return item.type === 'application/vnd.oasis.opendocument.text'; } }); $scope.uploader = uploader; }); diff --git a/client/components/import/import.jade b/client/components/import/import.jade index 35ab50a..4a01577 100644 --- a/client/components/import/import.jade +++ b/client/components/import/import.jade @@ -1,79 +1,79 @@ div.import-box(ng-controller='ImportCtrl') .row.upload-widget div.upload-button( type='button' nv-file-over='' uploader='uploader' ) input( type='file' nv-file-select='' uploader='uploader' multiple ) | Click to select files to upload, or drag them here - .row(ng-hide='!uploader.getNotUploadedItems().length') + .row(ng-hide='!uploader.queue.length') table.table thead tr th(width='50%') Name th(ng-show='uploader.isHTML5') Size th(ng-show='uploader.isHTML5') Progress th.status Status th.actions Actions tbody tr(ng-repeat='item in uploader.queue') td.name-cell span(tooltip='{{item.file.name}}' data-container='body') | {{item.file.name}} td(ng-show='uploader.isHTML5' nowrap) | {{item.file.size/1024/1024|number:2}} MB td(ng-show='uploader.isHTML5') progressbar(value='item.progress') {{item.progress}}% td.status.text-center span(ng-show='item.isSuccess') i.glyphicon.glyphicon-ok span(ng-show='item.isCancel') i.glyphicon.glyphicon-ban-circle span(ng-show='item.isError') i.glyphicon.glyphicon-remove td.actions(nowrap) button.btn.btn-success.btn-xs( ng-click='item.upload()' ng-disabled='item.isReady || item.isUploading || item.isSuccess' ) i.glyphicon.glyphicon-upload button.btn.btn-warning.btn-xs( ng-click='item.cancel()' ng-disabled='!item.isUploading' ) i.glyphicon.glyphicon-ban-circle button.btn.btn-danger.btn-xs( ng-click='item.remove()' ) i.glyphicon.glyphicon-trash //- div.progress-overall progressbar(value='uploader.progress') {{uploader.progress}}% div.btn-group.btn-group-justified div.btn.btn-success.btn-s( type='button' ng-click='uploader.uploadAll()' ng-disabled='!uploader.getNotUploadedItems().length' ) span.glyphicon.glyphicon-upload | Upload all div.btn.btn-warning.btn-s( type='button' ng-click='uploader.cancelAll()' ng-disabled='!uploader.isUploading' ) span.glyphicon.glyphicon-ban-circle | Cancel all div.btn.btn-danger.btn-s( type='button' ng-click='uploader.removeAll()' ng-disabled='!uploader.queue.length' ) span.glyphicon.glyphicon-trash | Remove all