Demo entry 2501344

r912

   

Submitted by anonymous on Aug 25, 2015 at 00:45
Language: Diff. Code size: 5.3 kB.

Index: lpoe-content/package.json
===================================================================
--- lpoe-content/package.json	(revision 911)
+++ lpoe-content/package.json	(revision 912)
@@ -15,6 +15,7 @@
     "angular-cookies": "~1.3.15",
     "angular-resource": "~1.3.15",
     "angular-route": "~1.3.15",
+    "angular-sanitize": "^1.4.4",
     "angular-ui-router": "^0.2.15",
     "jquery": "~2.1.4",
     "lodash": "^2.4.1",
Index: lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/directives/accordionPane.js
===================================================================
--- lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/directives/accordionPane.js	(revision 911)
+++ lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/directives/accordionPane.js	(revision 912)
@@ -39,8 +39,11 @@
                 'openOnLoad' : '@',
                 'category' : '@'
             },
-            controller: function(){
+            controller: function($scope) {
                 //Empty controller so other directives can require being 'under' a accordionPane
+                this.setHeading = function (element) {
+                    $scope.heading = element[1].outerHTML;
+                };
             },
             compile: function(element, attrs){
                 return function postLink(scope, element, attrs, accordionCtrl, transcludeFn){
@@ -81,7 +84,7 @@
                         _setOpenOnLoad();
                         _watchIsOpen();
                         _addPaneToController();
-                        _transcludeContent();
+                        // _transcludeContent();
                     }
 
                     /**
Index: lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/directives/accordionHeading.js
===================================================================
--- lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/directives/accordionHeading.js	(revision 0)
+++ lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/directives/accordionHeading.js	(revision 912)
@@ -0,0 +1,22 @@
+(function () {
+    'use strict';
+
+    angular.module('rz-accordion').directive('accordionHeading', [
+        '$window',
+        function ($window) {
+            return {
+                restrict: 'A',
+                transclude: true,
+                template: '',
+                replace: true,
+                require: '^accordionPane',
+                link: function(scope, element, attr, accordionPaneCtrl, transclude) {
+                    // Pass the heading to the accordion-pane controller
+                    // so that it can be transcluded into the right place in the template
+                    // [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat]
+                    accordionPaneCtrl.setHeading(transclude(scope, angular.noop));
+                }
+            };
+        }
+    ]);
+})();
\ No newline at end of file
Index: lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/index.js
===================================================================
--- lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/index.js	(revision 911)
+++ lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/index.js	(revision 912)
@@ -1,9 +1,10 @@
-angular.module('rz-accordion', ['ngAnimate']);
+require('angular-sanitize');
 
+angular.module('rz-accordion', ['ngAnimate', 'ngSanitize']);
+
 require('./constants/accordionConstants');
 require('./directives/accordion');
 require('./directives/accordionPane');
-require('./directives/accordionHeadingTransclude');
-require('./directives/accordionContentTransclude');
+require('./directives/accordionHeading');
 require('./directives/accordionControls');
 require('./controllers/accordion');
\ No newline at end of file
Index: lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/templates/accordion-pane.html
===================================================================
--- lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/templates/accordion-pane.html	(revision 911)
+++ lpoe-content/src/main/content/jcr_root/etc/designs/lpoe/src/assets/components/common/ui/rz-accordion/templates/accordion-pane.html	(revision 912)
@@ -1,4 +1,4 @@
 <div class="rz-accordion-pane">
-    <div class="rz-accordion-header" data-accordion-heading-transclude="" data-ng-click="toggleOpen()" data-ng-class="{'active' : isOpen}"></div>
-    <div class="rz-accordion-content" data-accordion-content-transclude="" data-ng-class="{'active' : isOpen}" data-ng-transclude=""></div>
+    <div class="rz-accordion-header" data-ng-click="toggleOpen()" data-ng-class="{'active' : isOpen}" data-ng-bind-html="heading"></div>
+    <div class="rz-accordion-content" data-ng-class="{'active' : isOpen}" data-ng-transclude=""></div>
 </div>
\ No newline at end of file

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).