From 78120bd989d78cc388273da067641771f3ddd9c4 Mon Sep 17 00:00:00 2001 From: norgeous Date: Wed, 16 Mar 2016 14:55:29 +0000 Subject: [PATCH] Use Bootstrap tooltips instead of plain title attributes By using data-original-title the tooltips live update without reapplying the js code, such as .tooltip('fixTitle') each time the content changes. This method also works well with angular expressions: data-original-title="{{'Download Rate' | translate}}" This example provides a bootstrap tooltip saying 'Download Rate' that changes automatically when the language is updated. --- gui/dark/assets/css/overrides.css | 4 ++++ gui/default/assets/css/overrides.css | 4 ++++ gui/default/index.html | 13 +++++++++---- gui/default/syncthing/core/tooltipDirective.js | 11 +++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 gui/default/syncthing/core/tooltipDirective.js diff --git a/gui/dark/assets/css/overrides.css b/gui/dark/assets/css/overrides.css index 690ad75e..154ade26 100644 --- a/gui/dark/assets/css/overrides.css +++ b/gui/dark/assets/css/overrides.css @@ -71,6 +71,10 @@ identicon { min-width: 250px; } +.tooltip{ + word-wrap:break-word; +} + .panel-heading .fa, .modal-header .fa { margin-right: 10px; } diff --git a/gui/default/assets/css/overrides.css b/gui/default/assets/css/overrides.css index 6b454127..3b6650da 100644 --- a/gui/default/assets/css/overrides.css +++ b/gui/default/assets/css/overrides.css @@ -71,6 +71,10 @@ identicon { min-width: 250px; } +.tooltip{ + word-wrap:break-word; +} + .panel-heading .fa, .modal-header .fa { margin-right: 10px; } diff --git a/gui/default/index.html b/gui/default/index.html index ce87bd4a..98394c67 100755 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -258,7 +258,9 @@  Folder Path - {{folder.path}} + + {{folder.path}} +  Error @@ -281,7 +283,7 @@  Scan Time Remaining - ~ {{scanRemaining(folder.id)}} + ~ {{scanRemaining(folder.id)}} @@ -344,7 +346,7 @@  Last File Received - + Updated Deleted {{folderStats[folder.id].lastFile.filename | basename}} @@ -451,7 +453,9 @@  Version - {{versionString()}} + + {{versionString()}} + @@ -620,6 +624,7 @@ + diff --git a/gui/default/syncthing/core/tooltipDirective.js b/gui/default/syncthing/core/tooltipDirective.js new file mode 100644 index 00000000..1e246600 --- /dev/null +++ b/gui/default/syncthing/core/tooltipDirective.js @@ -0,0 +1,11 @@ +angular.module('syncthing.core') + .directive('tooltip', function () { + return { + restrict: 'A', + link: function (scope, element, attributes) { + $(element).tooltip({ + html: 'true' + }); + } + }; +});