[VID-6] Initial rebase push
[vid.git] / epsdk-app-onap / src / main / webapp / static / fusion / js / att_angular_gridster / ui-gridster-tpls.js
1 /**\r
2 * FileName ui-gridster\r
3 * Version 0.0.1\r
4 * Build number ad58c6f4f8f8fd7f04ac457f95d76f09\r
5 * Date 08/17/2015\r
6 */\r
7 \r
8 \r
9 (function(angular, window){\r
10 angular.module("att.gridster", ["att.gridster.tpls", "att.gridster.utilities","att.gridster.gridster"]);\r
11 angular.module("att.gridster.tpls", ["template/gridster/gridster.html","template/gridster/gridsterItem.html","template/gridster/gridsterItemBody.html","template/gridster/gridsterItemFooter.html","template/gridster/gridsterItemHeader.html"]);\r
12 angular.module('att.gridster.utilities', [])\r
13         .factory('$extendObj', [function() {\r
14                 var _extendDeep = function(dst) {\r
15                     angular.forEach(arguments, function(obj) {\r
16                         if (obj !== dst) {\r
17                             angular.forEach(obj, function(value, key) {\r
18                                 if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {\r
19                                     _extendDeep(dst[key], value);\r
20                                 } else {\r
21                                     dst[key] = value;\r
22                                 }\r
23                             });\r
24                         }\r
25                     });\r
26                     return dst;\r
27                 };\r
28                 return {\r
29                     extendDeep: _extendDeep\r
30                 };\r
31             }]);\r
32 \r
33 angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities'])\r
34         .config(['$compileProvider', function($compileProvider) {\r
35                 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/);\r
36             }])\r
37         .constant('attGridsterConfig',\r
38                 {\r
39                     columns: 3,\r
40                     margins: [10, 10],\r
41                     outerMargin: true,\r
42                     pushing: true,\r
43                     floating: true,\r
44                     swapping: true,\r
45                     draggable: {\r
46                         enabled: true\r
47                     }\r
48                 })\r
49         .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) {\r
50                 return {\r
51                     restrict: 'EA',\r
52                     scope: {\r
53                         attGridsterOptions: '=?'\r
54                     },\r
55                     templateUrl: 'template/gridster/gridster.html',\r
56                     replace: false,\r
57                     transclude: true,\r
58                     controller: [function() {}],\r
59                     link: function(scope) {\r
60                         if (angular.isDefined(scope.attGridsterOptions)) {\r
61                             attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions);\r
62                         }\r
63                         scope.attGridsterConfig = attGridsterConfig;\r
64                     }\r
65                 };\r
66             }])\r
67         .directive('attGridsterItem', ['$timeout', function($timeout) {\r
68                 return {\r
69                     restrict: 'EA',\r
70                     require: ['^attGridster'],\r
71                     scope: {\r
72                         attGridsterItem: '='\r
73                     },\r
74                     templateUrl: 'template/gridster/gridsterItem.html',\r
75                     replace: false,\r
76                     transclude: true,\r
77                     controller: [function() {}]\r
78                 };\r
79             }])\r
80         .directive('attGridsterItemHeader', [function() {\r
81                 return {\r
82                     restrict: 'EA',\r
83                     require: ['^attGridsterItem'],\r
84                     scope: {\r
85                         headerText: '@',\r
86                         subHeaderText: '@?'\r
87                     },\r
88                     templateUrl: 'template/gridster/gridsterItemHeader.html',\r
89                     replace: true,\r
90                     transclude: true,\r
91                     link: function(scope, element) {\r
92                         if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) {\r
93                             angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0");\r
94                             angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText);\r
95                         }\r
96                     }\r
97                 };\r
98             }])\r
99         .directive('attGridsterItemBody', [function() {\r
100                 return {\r
101                     restrict: 'EA',\r
102                     require: ['^attGridsterItem'],\r
103                     scope: {},\r
104                     templateUrl: 'template/gridster/gridsterItemBody.html',\r
105                     replace: true,\r
106                     transclude: true\r
107                 };\r
108             }])\r
109         .directive('attGridsterItemFooter', ['$location', function($location) {\r
110                 return {\r
111                     restrict: 'EA',\r
112                     require: ['^attGridsterItem'],\r
113                     scope: {\r
114                         attGridsterItemFooterLink: '@?'\r
115                     },\r
116                     templateUrl: 'template/gridster/gridsterItemFooter.html',\r
117                     replace: true,\r
118                     transclude: true,\r
119                     controller: ['$scope', function($scope) {\r
120                             $scope.clickOnFooterLink = function(evt) {\r
121                                 evt.preventDefault();\r
122                                 evt.stopPropagation();\r
123                                 if ($scope.attGridsterItemFooterLink) {\r
124                                     $location.url($scope.attGridsterItemFooterLink);\r
125                                 }\r
126                             };\r
127                         }],\r
128                     link: function(scope, element) {\r
129                         if (angular.isDefined(scope.attGridsterItemFooterLink) && scope.attGridsterItemFooterLink) {\r
130                             element.attr("role", "link");\r
131                         }\r
132                     }\r
133                 };\r
134             }]);\r
135 angular.module("template/gridster/gridster.html", []).run(["$templateCache", function($templateCache) {\r
136   $templateCache.put("template/gridster/gridster.html",\r
137     "<div gridster='attGridsterConfig'><div ng-transclude></div></div>");\r
138 }]);\r
139 \r
140 angular.module("template/gridster/gridsterItem.html", []).run(["$templateCache", function($templateCache) {\r
141   $templateCache.put("template/gridster/gridsterItem.html",\r
142     "<div gridster-item='attGridsterItem' class=\"gridster-item-container\" ng-transclude></div>");\r
143 }]);\r
144 \r
145 angular.module("template/gridster/gridsterItemBody.html", []).run(["$templateCache", function($templateCache) {\r
146   $templateCache.put("template/gridster/gridsterItemBody.html",\r
147     "<div class=\"gridster-item-body\" ng-transclude></div>");\r
148 }]);\r
149 \r
150 angular.module("template/gridster/gridsterItemFooter.html", []).run(["$templateCache", function($templateCache) {\r
151   $templateCache.put("template/gridster/gridsterItemFooter.html",\r
152     "<div class=\"gridster-item-footer\" ng-click=\"clickOnFooterLink($event)\" tabindex=\"0\" ng-keydown=\"(($event.keyCode && $event.keyCode === 13) || ($event.which && $event.which === 13)) && clickOnFooterLink($event)\" >\n" +\r
153     "    <span class=\"gridster-item-footer-content\" ng-transclude></span>\n" +\r
154     "</div>");\r
155 }]);\r
156 \r
157 angular.module("template/gridster/gridsterItemHeader.html", []).run(["$templateCache", function($templateCache) {\r
158   $templateCache.put("template/gridster/gridsterItemHeader.html",\r
159     "<div class=\"gridster-item-header\">\n" +\r
160     "    <img gridster-item-drag src=\"static/fusion/images/att_angular_gridster/grips.png\" alt=\"||\" aria-label=\"Tap/Click to move\" class=\"gridster-item-handle\" />\n" +\r
161     "    <span class=\"gridster-item-header-content\" tabindex=\"0\" role=\"presentation\" aria-label=\"{{headerText}}\">{{headerText}}</span>\n" +\r
162     "    <span class=\"gridster-item-sub-header-content\" role=\"presentation\">{{subHeaderText}}</span>\n" +\r
163     "    <div class=\"gridster-item-header-buttons-container\" ng-transclude></div>\n" +\r
164     "</div>");\r
165 }]);\r
166 \r
167 return {}\r
168 })(angular, window);