highlight.js 484 B

12345678910111213141516171819
  1. 'use strict';
  2. angular.module('etcdControlPanel')
  3. .directive('highlight', function(keyPrefix) {
  4. return {
  5. restrict: 'E',
  6. scope: {
  7. highlightBase: '=',
  8. highlightCurrent: '='
  9. },
  10. link: function(scope, element, attrs) {
  11. var base = _.str.strRight(scope.highlightBase, keyPrefix),
  12. current = _.str.trim(scope.highlightCurrent, '/');
  13. if (base === current) {
  14. element.parent().parent().addClass('etcd-selected');
  15. }
  16. }
  17. };
  18. });