mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 15:17:57 +01:00
Fix file modal routing
This commit is contained in:
parent
517e4a4507
commit
46079393d5
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* File view controller.
|
||||
*/
|
||||
angular.module('docs').controller('FileView', function($uibModal, $state, $stateParams) {
|
||||
angular.module('docs').controller('FileView', function($uibModal, $state, $stateParams, $timeout) {
|
||||
var modal = $uibModal.open({
|
||||
windowClass: 'modal modal-fileview',
|
||||
templateUrl: 'partial/docs/file.view.html',
|
||||
@ -17,6 +17,12 @@ angular.module('docs').controller('FileView', function($uibModal, $state, $state
|
||||
modal.closed = true;
|
||||
}, function() {
|
||||
modal.closed = true;
|
||||
$state.go('^', { id: $stateParams.id });
|
||||
$timeout(function () {
|
||||
// After all router transitions are passed,
|
||||
// if we are still on the file route, go back to the document
|
||||
if ($state.current.name === 'document.view.content.file') {
|
||||
$state.go('^', {id: $stateParams.id});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* File view controller.
|
||||
*/
|
||||
angular.module('share').controller('FileView', function($uibModal, $state, $stateParams) {
|
||||
angular.module('share').controller('FileView', function($uibModal, $state, $stateParams, $timeout) {
|
||||
var modal = $uibModal.open({
|
||||
windowClass: 'modal modal-fileview',
|
||||
templateUrl: 'partial/share/file.view.html',
|
||||
@ -17,6 +17,12 @@ angular.module('share').controller('FileView', function($uibModal, $state, $stat
|
||||
modal.closed = true;
|
||||
},function() {
|
||||
modal.closed = true;
|
||||
$timeout(function () {
|
||||
// After all router transitions are passed,
|
||||
// if we are still on the file route, go back to the share
|
||||
if ($state.current.name === 'share.file') {
|
||||
$state.go('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user