Yangman - jQuery to angular.element & strings to constants 64/43964/5
authormichal.kovacik <mikovaci@cisco.com>
Mon, 15 Aug 2016 11:56:48 +0000 (13:56 +0200)
committerDaniel Malachovsky <dmalacho@cisco.com>
Thu, 18 Aug 2016 14:57:25 +0000 (16:57 +0200)
- Bug 6394 - Review for YangMan

Change-Id: I0d6e7dd688f48ed52e3dcacb6f1e8b95c49b657f
Signed-off-by: michal.kovacik <mikovaci@cisco.com>
modules/common-yangutils-resources/src/main/resources/yangutils/constants.js
modules/yangman-resources/src/main/resources/yangman/controllers/modules-list.controller.js
modules/yangman-resources/src/main/resources/yangman/directives/abn-tree.directive.js
modules/yangman-resources/src/main/resources/yangman/services/yangman-design.services.js

index b03935bb09e1c6b1f5e82393cd1e0f18f7799221..b707c50fd1450f30427e55efc5ec7d438c727697 100644 (file)
@@ -33,6 +33,10 @@ function () {
         OPERATION_DELETE: 'DELETE',
         OPERATION_POST: 'POST',
         REQUEST_DATA_TYPE_RECEIVED: 'RECEIVED',
+        ICON_EXPAND_ADD: 'add',
+        ICON_COLLAPSE_REMOVE: 'remove',
+        ICON_KEYBOARD_ARROW_RIGHT: 'keyboard_arrow_right',
+        EXPAND_LEVEL_THREE: '3',
     };
 
 });
index b801edf1277cf3e3c5c24897ecdaf7eecb0d9561..470c5c93ab0d7a8d37bad5d0bf88f4317e9704c1 100644 (file)
@@ -118,7 +118,7 @@ define([
          * Set and expand module in tree
          */
         function setModule(module, e){
-            if ( $(e.target).hasClass('top-element') ) {
+            if ( angular.element(e.target).hasClass('top-element') ) {
                 module.expanded = !module.expanded;
             }
         }
index 1244d041b596bd4acd2742540773f2380c1760b5..138edb46dadf014cfbd0ec06e6766c148bc2227b 100644 (file)
@@ -2,7 +2,7 @@ define(['angular'], function (angular) {
     'use strict';
 
     angular.module('app.yangman').directive('abnApiTree', [
-        '$timeout', function ($timeout) {
+        '$timeout', 'constants', function ($timeout, constants) {
             return {
                 restrict: 'E',
                 templateUrl: 'src/app/yangman/views/directives/abn-tree.tpl.html',
@@ -27,16 +27,16 @@ define(['angular'], function (angular) {
                         tree;
 
                     if (attrs.iconExpand == null) {
-                        attrs.iconExpand = 'add';
+                        attrs.iconExpand = constants.ICON_EXPAND_ADD;
                     }
                     if (attrs.iconCollapse == null) {
-                        attrs.iconCollapse = 'remove';
+                        attrs.iconCollapse = constants.ICON_COLLAPSE_REMOVE;
                     }
                     if (attrs.iconLeaf == null) {
-                        attrs.iconLeaf = 'keyboard_arrow_right';
+                        attrs.iconLeaf = constants.ICON_KEYBOARD_ARROW_RIGHT;
                     }
                     if (attrs.expandLevel == null) {
-                        attrs.expandLevel = '3';
+                        attrs.expandLevel = constants.EXPAND_LEVEL_THREE;
                     }
                     expandLevel = parseInt(attrs.expandLevel, 10);
                     if (!scope.treeData) {
index 1eb37f4c6ffc103b9647e2577547e1ed2ce8565b..cd2de281ee7eb99cb1a856030aedb4354c044b20 100644 (file)
@@ -74,7 +74,7 @@ define([], function () {
          * Hide main menu
          */
         function hideMainMenu(){
-            $('#wrapper').addClass('toggled');
+            angular.element('#wrapper').addClass('toggled');
         }
 
         /**
@@ -83,10 +83,10 @@ define([], function () {
          */
         function setDraggableLeftPanel(){
             if (localStorage.getItem('yangman__left-panel-width') !== null) {
-                $('#left-panel').width(localStorage.getItem('yangman__left-panel-width'));
+                angular.element('#left-panel').width(localStorage.getItem('yangman__left-panel-width'));
             }
 
-            $('.ym-resizable-e').resizable({
+            angular.element('.ym-resizable-e').resizable({
                 handles: 'e',
                 minWidth: 300,
                 stop: function(event, ui) {
@@ -102,7 +102,7 @@ define([], function () {
 
         function setJsonSplitter(cbk){
             $timeout(function () {
-                $('.ym-resizable-s').resizable({
+                angular.element('.ym-resizable-s').resizable({
                     handles: 's',
                     minHeight: 200,
                     stop: function(event, ui) {
@@ -117,8 +117,8 @@ define([], function () {
          * .yangmanModule__module-detail .tabs
          */
         function setModuleDetailHeight() {
-            var height = 'calc(100% - ' + $('.yangmanModule__module-detail h4').outerHeight(true) + 'px)';
-            $('.yangmanModule__module-detail .tabs').css({ height: height });
+            var height = 'calc(100% - ' + angular.element('.yangmanModule__module-detail h4').outerHeight(true) + 'px)';
+            angular.element('.yangmanModule__module-detail .tabs').css({ height: height });
         }
 
     }