diff --git a/services/web/app/views/project/editor/header.pug b/services/web/app/views/project/editor/header.pug index 594eb87b6e..a1c13032f9 100644 --- a/services/web/app/views/project/editor/header.pug +++ b/services/web/app/views/project/editor/header.pug @@ -34,6 +34,7 @@ header.toolbar.toolbar-header.toolbar-with-labels( tooltip-class="project-name-tooltip" tooltip-placement="bottom", tooltip-append-to-body="true", + tooltip-enable="state.overflowed" ) {{ project.name }} input.form-control( diff --git a/services/web/public/coffee/ide/settings/controllers/ProjectNameController.coffee b/services/web/public/coffee/ide/settings/controllers/ProjectNameController.coffee index 6195feff13..1cb6644bed 100644 --- a/services/web/public/coffee/ide/settings/controllers/ProjectNameController.coffee +++ b/services/web/public/coffee/ide/settings/controllers/ProjectNameController.coffee @@ -2,9 +2,13 @@ define [ "base" ], (App) -> MAX_PROJECT_NAME_LENGTH = 150 - App.controller "ProjectNameController", ["$scope", "settings", "ide", ($scope, settings, ide) -> + App.controller "ProjectNameController", ["$scope", "$element", "settings", "ide", ($scope, $element, settings, ide) -> + projectNameReadOnlyEl = $element.find(".name")[0] + $scope.state = renaming: false + overflowed: false + $scope.inputs = {} $scope.startRenaming = () -> @@ -29,4 +33,7 @@ define [ $scope.$watch "project.name", (name) -> if name? window.document.title = name + " - Online LaTeX Editor ShareLaTeX" + $scope.$applyAsync () -> + # This ensures that the element is measured *after* the binding is done (i.e. project name is rendered). + $scope.state.overflowed = (projectNameReadOnlyEl.scrollWidth > projectNameReadOnlyEl.clientWidth) ] \ No newline at end of file