diff --git a/index.html b/index.html index d38d79b..df3ff1f 100644 --- a/index.html +++ b/index.html @@ -58,5 +58,6 @@ + diff --git a/js/controllers/boards.js b/js/controllers/boards.js index 12e8e5a..4701c3d 100644 --- a/js/controllers/boards.js +++ b/js/controllers/boards.js @@ -83,7 +83,7 @@ function ($scope, $routeParams, $location, $interval, $window, if ($scope.boardId) { $interval.cancel($scope.interval); } - if ($scope.boardsLoaded && !$scope.boardId && parseInt($scope.currentUser.defaultBoard)) { + if ($scope.boardsLoaded && !$scope.boardId && $scope.currentUser && parseInt($scope.currentUser.defaultBoard)) { $interval.cancel($scope.interval); $location.path('boards/' + $scope.currentUser.defaultBoard); } diff --git a/js/controllers/header.js b/js/controllers/header.js index 0d80fd2..e01babd 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -33,7 +33,9 @@ function ($scope, $window, $location, UserService, AuthenticationService, AlertS $scope.display.smallText = ' - File Viewer'; } - $.noty.closeAll(); // Clear any alerts on page load. + try { + $.noty.closeAll(); // Clear any alerts on page load. + } catch(e) {} $scope.logout = function() { UserService.logOut() diff --git a/js/directives/keepScrollPos.js b/js/directives/keepScrollPos.js new file mode 100644 index 0000000..7fb5f35 --- /dev/null +++ b/js/directives/keepScrollPos.js @@ -0,0 +1,30 @@ +// Source: http://stackoverflow.com/a/25073496/1110183 +taskBoardDirectives.directive("keepScrollPos", function($route, $window, $timeout, $location, $anchorScroll) { + + // cache scroll position of each route's templateUrl + var scrollPosCache = {}; + + // compile function + return function(scope, element, attrs) { + scope.$on('$routeChangeStart', function() { + // store scroll position for the current view + if ($route.current) { + scrollPosCache[$route.current.loadedTemplateUrl] = [ $window.pageXOffset, $window.pageYOffset ]; + } + }); + + scope.$on('$routeChangeSuccess', function() { + // if hash is specified explicitly, it trumps previously stored scroll position + if ($location.hash()) { + $anchorScroll(); + + // else get previous scroll position; if none, scroll to the top of the page + } else { + var prevScrollPos = scrollPosCache[$route.current.loadedTemplateUrl] || [ 0, 0 ]; + $timeout(function() { + $window.scrollTo(prevScrollPos[0], prevScrollPos[1]); + }, 0); + } + }); + } + }); \ No newline at end of file diff --git a/partials/board.html b/partials/board.html index 1234673..416497b 100644 --- a/partials/board.html +++ b/partials/board.html @@ -37,7 +37,7 @@
+ data-context-menu="onContextMenu(lane.id)" data-target="laneMenu" data-keep-scroll-pos>

{{ lane.name }} {{ lane.ownItem.length || 0 }} @@ -59,7 +59,7 @@

{{ item.title }}

{{ item.points }}

-
+

Assigned To: {{ userNames[item.assignee] }}