Skip to content

update the code to not use the deprecated tooltip-html-unsafe #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions angular-ui-tab-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ angular.module('ui.tab.scroll', [])
}
)
.directive('scrollableTabset', [
'scrollableTabsetConfig', '$window', '$interval', '$timeout',
function(scrollableTabsetConfig, $window, $interval, $timeout) {
'scrollableTabsetConfig', '$window', '$interval', '$timeout','$sce',
function(scrollableTabsetConfig, $window, $interval, $timeout, $sce) {

var timeoutId = null;

Expand Down Expand Up @@ -112,37 +112,31 @@ angular.module('ui.tab.scroll', [])

template: [
'<div class="ui-tabs-scrollable">',
'<button type="button" ng-hide="hideButtons" ng-disabled="disableLeft()" class="btn nav-button left-nav-button" tooltip-placement="{{tooltipLeftDirection()}}" tooltip-html-unsafe="{{tooltipLeftContent()}}">',
'<button type="button" ng-hide="hideButtons" ng-disabled="disableLeft()" class="btn nav-button left-nav-button" tooltip-placement="{{tooltipLeftDirection()}}" tooltip-html="tooltipLeftHtml">',
'<span class="{{scrollLeftIconClass()}}"></span>',
'</button>',
'<div class="spacer" ng-class="{\'hidden-buttons\': hideButtons}" ng-transclude></div>',
'<button type="button" ng-hide="hideButtons" ng-disabled="disableRight()" class="btn nav-button right-nav-button" tooltip-placement="{{tooltipRightDirection()}}" tooltip-html-unsafe="{{tooltipRightContent()}}">',
'<button type="button" ng-hide="hideButtons" ng-disabled="disableRight()" class="btn nav-button right-nav-button" tooltip-placement="{{tooltipRightDirection()}}" tooltip-html="tooltipRightHtml">',
'<span class="{{scrollRightIconClass()}}"></span>',
'</button>',
'</div>'
].join(''),

link: function($scope, $el) {

$scope.toTheLeftHTML = '';
$scope.toTheRightHTML = '';
$scope.tooltipRightHtml = '';
$scope.tooltipLeftHtml = '';
var toTheLeftHTML = '';
var toTheRightHTML = '';

var showTooltips = angular.isDefined($scope.showTooltips)? $scope.showTooltips : scrollableTabsetConfig.showTooltips;

$scope.disableLeft = function() {
return !$scope.toTheLeftHTML;
return !toTheLeftHTML;
};

$scope.disableRight = function() {
return !$scope.toTheRightHTML;
};

$scope.tooltipLeftContent = function() {
return showTooltips ? $scope.toTheLeftHTML : '';
};

$scope.tooltipRightContent = function() {
return showTooltips ? $scope.toTheRightHTML : '';
return !toTheRightHTML;
};

$scope.tooltipLeftDirection = function() {
Expand Down Expand Up @@ -184,7 +178,8 @@ angular.module('ui.tab.scroll', [])

});

$scope.toTheLeftHTML = nodes.join('<br>');
toTheLeftHTML = nodes.join('<br>');
$scope.tooltipLeftHtml = showTooltips ? $sce.trustAsHtml(toTheLeftHTML) : '';
};

$scope.toTheRight = function() {
Expand All @@ -206,7 +201,8 @@ angular.module('ui.tab.scroll', [])

});

$scope.toTheRightHTML = nodes.join('<br>');
toTheRightHTML = nodes.join('<br>');
$scope.tooltipRightHtml = showTooltips ? $sce.trustAsHtml(toTheRightHTML) : '';
};

$scope.recalcSides = function() {
Expand Down