Yangman - Show all items box showed for a moment
[dlux.git] / modules / yangman-resources / src / main / resources / yangman / directives / yang-form-menu.directive.js
index 718e8767bae6815b13d459be5e90360366e4b373..585f4e4c9ff47977bf361d9dbcc3dd2b423e5d7a 100644 (file)
@@ -1,7 +1,7 @@
 define(['angular'], function (angular) {
     'use strict';
 
-    angular.module('app.yangman').controller('yangFormMenu', menuDirective);
+    angular.module('app.yangman').directive('yangFormMenu', menuDirective);
 
     menuDirective.$inject = [];
 
@@ -14,8 +14,8 @@ define(['angular'], function (angular) {
                 augmentations: '=',
                 allowItems: '=',
                 isActionMenu: '&',
-                isNodeInfo: '&',
-                addListItem: '&',
+                addListItemFunc: '&',
+                addListItem: '=',
                 yangForm: '=',
                 yangList: '=',
             },
@@ -53,7 +53,34 @@ define(['angular'], function (angular) {
                  */
                 function hideInfoBox(){
                     $scope.infoBox = false;
+                    angular.element('#infoBox').addClass('ng-hide');
                 }
+
+                $scope.$on('hideInfoBox', function () {
+                    hideInfoBox();
+                });
+            },
+            link: function (scope, element, attrs) {
+                scope.isActive = false;
+
+                // methods
+                scope.closeMenu = closeMenu;
+                scope.openMenu = openMenu;
+
+                /**
+                 * Close Yang menu
+                 */
+                function closeMenu(){
+                    scope.isActive = false;
+                }
+
+                /**
+                 * Open Yang menu
+                 */
+                function openMenu(){
+                    scope.isActive = true;
+                }
+
             },
         };
     }