1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-19 08:52:25 +01:00

Fix a bug: back bouton can't return to previously page in projects page (list/new/show/edit)

This commit is contained in:
Du Peng 2022-04-20 16:42:59 +02:00
parent 432bcdd521
commit 6f67a5eaff
2 changed files with 56 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# Changelog Fab-manager # Changelog Fab-manager
- Fix a bug: back bouton can't return to previously page in projects page (list/new/show/edit)
- Fix a security issue: updated async to 2.6.4 to fix [CVE-2021-43138](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-43138) - Fix a security issue: updated async to 2.6.4 to fix [CVE-2021-43138](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-43138)
## v5.3.11 2022 April 15 ## v5.3.11 2022 April 15

View File

@ -397,6 +397,20 @@ Application.Controllers.controller('ProjectsController', ['$scope', '$state', 'P
return true; return true;
}; };
/**
* Overlap global function to allow the user to navigate to the previous screen
* If no previous $state were recorded, navigate to the project list page
*/
$scope.backPrevLocation = function (event) {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '' || $state.prevState === 'app.public.projects_list') {
$state.prevState = 'app.public.home';
return $state.go($state.prevState, {});
}
window.history.back();
};
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
/** /**
@ -474,6 +488,20 @@ Application.Controllers.controller('NewProjectController', ['$rootScope', '$scop
$scope.matchingMembers = []; $scope.matchingMembers = [];
/*
* Overlap global function to allow the user to navigate to the previous screen
* If no previous $state were recorded, navigate to the project list page
*/
$scope.backPrevLocation = function (event) {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '') {
$state.prevState = 'app.public.projects_list';
return $state.go($state.prevState, {});
}
window.history.back();
};
// Using the ProjectsController // Using the ProjectsController
return new ProjectsController($rootScope, $scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, allowedExtensions, _t); return new ProjectsController($rootScope, $scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, allowedExtensions, _t);
} }
@ -502,6 +530,19 @@ Application.Controllers.controller('EditProjectController', ['$rootScope', '$sco
}); });
}); });
/**
* Overlap global function to allow the user to navigate to the previous screen
* If no previous $state were recorded, navigate to the project show page
*/
$scope.backPrevLocation = function (event) {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '') {
$state.prevState = 'app.public.projects_show';
}
$state.go($state.prevState, { id: $transition$.params().id });
};
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
/** /**
@ -639,5 +680,19 @@ Application.Controllers.controller('ShowProjectController', ['$scope', '$state',
* Return the URL allowing to share the current project on the Twitter social network * Return the URL allowing to share the current project on the Twitter social network
*/ */
$scope.shareOnTwitter = function () { return `https://twitter.com/intent/tweet?url=${encodeURIComponent($state.href('app.public.projects_show', { id: $scope.project.slug }, { absolute: true }))}&text=${encodeURIComponent($scope.project.name)}`; }; $scope.shareOnTwitter = function () { return `https://twitter.com/intent/tweet?url=${encodeURIComponent($state.href('app.public.projects_show', { id: $scope.project.slug }, { absolute: true }))}&text=${encodeURIComponent($scope.project.name)}`; };
/**
* Overlap global function to allow the user to navigate to the previous screen
* If no previous $state were recorded, navigate to the project list page
*/
$scope.backPrevLocation = function (event) {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '') {
$state.prevState = 'app.public.projects_list';
return $state.go($state.prevState, {});
}
window.history.back();
};
} }
]); ]);