Sindbad~EG File Manager

Current Path : /lib/python2.7/site-packages/glances/outputs/static/js/
Upload File :
Current File : //lib/python2.7/site-packages/glances/outputs/static/js/directives.js

glancesApp.directive("sortableTh", function() {
    return {
        restrict: 'A',
        scope: {
            sorter: '='
        },
        link: function (scope, element, attrs) {

            scope.$watch(function() {
                return scope.sorter.column;
            }, function(newValue, oldValue) {

                if (angular.isArray(newValue)) {
                    if (newValue.indexOf(attrs.column) !== -1) {
                        element.addClass('sort');
                    } else {
                        element.removeClass('sort');
                    }
                } else {
                    if (attrs.column === newValue) {
                        element.addClass('sort');
                    } else {
                        element.removeClass('sort');
                    }
                }

            });

            element.on('click', function() {

                scope.sorter.column = attrs.column;

                scope.$apply();
            });
        }
    };
});

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists