Skip to content

Commit

Permalink
Merge 45e3262 into 1f7e8a5
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsworth8801 committed Jan 31, 2020
2 parents 1f7e8a5 + 45e3262 commit d640afc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 13 additions & 3 deletions seed/static/seed/js/controllers/menu_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,23 @@ angular.module('BE.seed.controller.menu', [])
});
$scope.$on('app_success', function () {
$rootScope.route_load_error = false;
})
});
$scope.$on('organization_list_updated', function () {
init();
});

$scope.is_active = function (menu_item) {
if (menu_item === $location.path()) {
if ($state.current.url.split('/').length > 1) {
$location.search($location.path(), $state.current.url);
}
if($rootScope.stay_on_page && menu_item === '/' + $state.current.url.split('/')[1]) {
return true;
} else if (menu_item === $location.path()) {
if ($rootScope.stay_on_page) {
return false;
} else if (!$rootScope.stay_on_page && menu_item === ('/' + $state.current.url.split('/')[1])) {
return true;
}
return true;
} else if (menu_item !== '/' && _.startsWith($location.path(), menu_item)) {
return true;
Expand Down Expand Up @@ -96,7 +106,7 @@ angular.module('BE.seed.controller.menu', [])
$scope.collapsed_controller = !isNavExpanded;
$scope.narrow_controller = isNavExpanded;
$scope.wide_controller = !isNavExpanded;
}
};

// returns true if menu toggle has never been clicked, i.e. first run, else returns false
$scope.menu_toggle_has_never_been_clicked = function () {
Expand Down
5 changes: 4 additions & 1 deletion seed/static/seed/js/controllers/modified_modal_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
*/
angular.module('BE.seed.controller.modified_modal', [])
.controller('modified_modal_controller', [
'$rootScope',
'$scope',
'$uibModalInstance',
function ($scope, $uibModalInstance) {
function ($rootScope, $scope, $uibModalInstance) {
$scope.leave = function () {
$rootScope.stay_on_page = false;
$uibModalInstance.close();
};

$scope.stay = function () {
$rootScope.stay_on_page = true;
$uibModalInstance.dismiss();
};
}]);

0 comments on commit d640afc

Please sign in to comment.