diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index 821e9e7ee6..829525e867 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -233,6 +233,7 @@ block content ul.list-unstyled.project-list.structured-list( select-all-list, ng-if="projects.length > 0", + max-height="windowHeight - 290", ng-cloak ) li.container-fluid diff --git a/services/web/public/coffee/directives/maxHeight.coffee b/services/web/public/coffee/directives/maxHeight.coffee new file mode 100644 index 0000000000..5a2a92c793 --- /dev/null +++ b/services/web/public/coffee/directives/maxHeight.coffee @@ -0,0 +1,11 @@ +define [ + "base" +], (App) -> + App.directive "maxHeight", () -> + return { + restrict: "A" + link: (scope, element, attrs) -> + scope.$watch attrs.maxHeight, (value) -> + if value? + element.css("max-height": value) + } \ No newline at end of file diff --git a/services/web/public/coffee/main.coffee b/services/web/public/coffee/main.coffee index c2a70fdb78..dcf5ea735b 100644 --- a/services/web/public/coffee/main.coffee +++ b/services/web/public/coffee/main.coffee @@ -11,6 +11,7 @@ define [ "directives/fineUpload" "directives/onEnter" "directives/selectAll" + "directives/maxHeight" "filters/formatDate" ], () -> angular.bootstrap(document.body, ["SharelatexApp"]) \ No newline at end of file diff --git a/services/web/public/coffee/main/project-list.coffee b/services/web/public/coffee/main/project-list.coffee index 0ad0c94660..fbae8a339e 100644 --- a/services/web/public/coffee/main/project-list.coffee +++ b/services/web/public/coffee/main/project-list.coffee @@ -50,7 +50,7 @@ define [ ] - App.controller "ProjectPageController", ($scope, $modal, $q, queuedHttp) -> + App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp) -> $scope.projects = window.data.projects $scope.visibleProjects = $scope.projects $scope.tags = window.data.tags @@ -58,6 +58,11 @@ define [ $scope.selectedProjects = [] $scope.filter = "all" + $scope.windowHeight = $window.innerHeight + angular.element($window).bind "resize", () -> + $scope.windowHeight = $window.innerHeight + $scope.$apply() + # Allow tags to be accessed on projects as well projectsById = {} for project in $scope.projects