diff --git a/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js b/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js index f573e056..107468ad 100644 --- a/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js +++ b/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js @@ -109,13 +109,13 @@ App.controller('DocumentEdit', function($rootScope, $scope, $q, $http, $state, $ var formData = new FormData(); formData.append('id', data.id); formData.append('file', file); - + // Send the file var promiseFile = $http.put('api/file', formData, { - headers: { 'Content-Type': false }, - transformRequest: function(data) { return data; } - }); + headers: { 'Content-Type': undefined }, + transformRequest: function(data) { return data; } + }); // TODO Handle progression when $q.notify will be released diff --git a/docs-web/src/main/webapp/app/docs/controller/FileView.js b/docs-web/src/main/webapp/app/docs/controller/FileView.js index f40e60ab..b16073a8 100644 --- a/docs-web/src/main/webapp/app/docs/controller/FileView.js +++ b/docs-web/src/main/webapp/app/docs/controller/FileView.js @@ -7,7 +7,7 @@ App.controller('FileView', function($modal, $state, $stateParams) { var modal = $modal.open({ windowClass: 'modal modal-fileview', templateUrl: 'partial/docs/file.view.html', - controller: function($scope, $state, $stateParams, Restangular, dialog) { + controller: function($rootScope, $scope, $state, $stateParams, Restangular) { // Load files Restangular.one('file').getList('list', { id: $stateParams.id }).then(function(data) { $scope.files = data.files; @@ -28,7 +28,6 @@ App.controller('FileView', function($modal, $state, $stateParams) { if (value.id == $stateParams.fileId) { var next = $scope.files[key + 1]; if (next) { - dialog.close({}); $state.transitionTo('document.view.file', { id: $stateParams.id, fileId: next.id }); } } @@ -43,7 +42,6 @@ App.controller('FileView', function($modal, $state, $stateParams) { if (value.id == $stateParams.fileId) { var previous = $scope.files[key - 1]; if (previous) { - dialog.close({}); $state.transitionTo('document.view.file', { id: $stateParams.id, fileId: previous.id }); } } @@ -61,13 +59,17 @@ App.controller('FileView', function($modal, $state, $stateParams) { * Close the file preview. */ $scope.closeFile = function () { - dialog.close(); + modal.dismiss(); }; // Close the modal when the user exits this state - var off = $scope.$on('$stateChangeStart', function(event, toState){ - if (dialog.isOpen()) { - dialog.close(toState.name == 'document.view.file' ? {} : null); + var off = $rootScope.$on('$stateChangeStart', function(event, toState) { + if (!modal.closed) { + if (toState.name == 'document.view.file') { + modal.close(); + } else { + modal.dismiss(); + } } off(); }); @@ -75,9 +77,11 @@ App.controller('FileView', function($modal, $state, $stateParams) { }); // Returns to document view on file close - modal.result.then(function(result) { - if (result == null) { - $state.transitionTo('document.view', { id: $stateParams.id }); - } + modal.closed = false; + modal.result.then(function() { + modal.closed = true; + }, function() { + modal.closed = true; + $state.transitionTo('document.view', { id: $stateParams.id }); }); }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/Navigation.js b/docs-web/src/main/webapp/app/docs/controller/Navigation.js index 7838ef4f..3579050e 100644 --- a/docs-web/src/main/webapp/app/docs/controller/Navigation.js +++ b/docs-web/src/main/webapp/app/docs/controller/Navigation.js @@ -4,7 +4,9 @@ * Navigation controller. */ App.controller('Navigation', function($scope, $http, $state, $rootScope, User, Restangular) { - $rootScope.userInfo = User.userInfo(); + User.userInfo().then(function(data) { + $rootScope.userInfo = data; + }); // Last time when the errors logs was checked $scope.lastLogCheck = new Date().getTime(); @@ -47,7 +49,9 @@ App.controller('Navigation', function($scope, $http, $state, $rootScope, User, R */ $scope.logout = function($event) { User.logout().then(function() { - $rootScope.userInfo = User.userInfo(true); + User.userInfo(true).then(function(data) { + $rootScope.userInfo = data; + }); $state.transitionTo('main'); }); $event.preventDefault(); diff --git a/docs-web/src/main/webapp/index.html b/docs-web/src/main/webapp/index.html index 34748982..02bed066 100644 --- a/docs-web/src/main/webapp/index.html +++ b/docs-web/src/main/webapp/index.html @@ -57,34 +57,43 @@ -