mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Only show the tooltip if the project name is truncated.
This commit is contained in:
@@ -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)
|
||||
]
|
||||
Reference in New Issue
Block a user