mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 19:02:57 +00:00
Only show the tooltip if the project name is truncated.
This commit is contained in:
parent
5b8c36dfc0
commit
6b9b8480a8
2 changed files with 9 additions and 1 deletions
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
]
|
Loading…
Reference in a new issue