mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Fix file modal routing
This commit is contained in:
parent
517e4a4507
commit
46079393d5
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* File view controller.
|
* 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({
|
var modal = $uibModal.open({
|
||||||
windowClass: 'modal modal-fileview',
|
windowClass: 'modal modal-fileview',
|
||||||
templateUrl: 'partial/docs/file.view.html',
|
templateUrl: 'partial/docs/file.view.html',
|
||||||
@ -17,6 +17,12 @@ angular.module('docs').controller('FileView', function($uibModal, $state, $state
|
|||||||
modal.closed = true;
|
modal.closed = true;
|
||||||
}, function() {
|
}, function() {
|
||||||
modal.closed = true;
|
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.
|
* 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({
|
var modal = $uibModal.open({
|
||||||
windowClass: 'modal modal-fileview',
|
windowClass: 'modal modal-fileview',
|
||||||
templateUrl: 'partial/share/file.view.html',
|
templateUrl: 'partial/share/file.view.html',
|
||||||
@ -17,6 +17,12 @@ angular.module('share').controller('FileView', function($uibModal, $state, $stat
|
|||||||
modal.closed = true;
|
modal.closed = true;
|
||||||
},function() {
|
},function() {
|
||||||
modal.closed = true;
|
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 });
|
$state.go('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user