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

@ -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 });
});
};

View File

@ -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",