Closes #223: open document after creation

This commit is contained in:
Benjamin Gamard 2018-04-02 16:39:38 +02:00
parent f9b61546ab
commit 9b1456e1a7
2 changed files with 5 additions and 18 deletions

View File

@ -115,22 +115,10 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
// When all files upload are over, attach orphan files and move on // When all files upload are over, attach orphan files and move on
var navigateNext = function() { var navigateNext = function() {
attachOrphanFiles(data).then(function(resolve) { attachOrphanFiles(data).then(function() {
if ($scope.isEdit()) { // Open the edited/created document
// Go back to the edited document $scope.pageDocuments();
$scope.pageDocuments(); $state.go('document.view', { id: data.id });
$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();
}
}); });
}; };

View File

@ -146,7 +146,6 @@
"edit": { "edit": {
"document_edited_with_errors": "Document successfully edited but some files cannot be uploaded", "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_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", "quota_reached": "Quota reached",
"primary_metadata": "Primary metadata", "primary_metadata": "Primary metadata",
"title_placeholder": "A name given to the resource", "title_placeholder": "A name given to the resource",