From 9b1456e1a706f1a2704470196edfd37ad68c4c15 Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Mon, 2 Apr 2018 16:39:38 +0200 Subject: [PATCH] Closes #223: open document after creation --- .../docs/controller/document/DocumentEdit.js | 22 +++++-------------- docs-web/src/main/webapp/src/locale/en.json | 1 - 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js index 7563aec0..3d979f1e 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js @@ -22,7 +22,7 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $ $scope.closeAlert = function(index) { $scope.alerts.splice(index, 1); }; - + /** * Returns a promise for typeahead title. */ @@ -115,22 +115,10 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $ // When all files upload are over, attach orphan files and move on var navigateNext = function() { - attachOrphanFiles(data).then(function(resolve) { - if ($scope.isEdit()) { - // Go back to the edited document - $scope.pageDocuments(); - $state.go('document.view', { id: $stateParams.id }); - } else { - // Reset the scope and stay here - var fileUploadCount = _.size($scope.newFiles) + resolve.length; - $scope.alerts.unshift({ - type: 'success', - msg: $translate.instant('document.edit.document_added', { count: fileUploadCount }) - }); - - $scope.resetForm(); - $scope.loadDocuments(); - } + attachOrphanFiles(data).then(function() { + // Open the edited/created document + $scope.pageDocuments(); + $state.go('document.view', { id: data.id }); }); }; diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json index 27579683..6b0ce223 100644 --- a/docs-web/src/main/webapp/src/locale/en.json +++ b/docs-web/src/main/webapp/src/locale/en.json @@ -146,7 +146,6 @@ "edit": { "document_edited_with_errors": "Document successfully edited but some files cannot be uploaded", "document_added_with_errors": "Document successfully added but some files cannot be uploaded", - "document_added": "Document successfully added (with {{ count }} file{{ count > 1 ? 's' : '' }})", "quota_reached": "Quota reached", "primary_metadata": "Primary metadata", "title_placeholder": "A name given to the resource",