From 7a9441b3c5d73ad5b1e405506c9461df50d4b5ed Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Wed, 26 Aug 2015 11:17:44 -0400 Subject: [PATCH] Fixes for PR issues --- dist/angular-patternfly.js | 141 ++++++++++++++++++++-- dist/angular-patternfly.min.js | 2 +- dist/styles/angular-patternfly.css | 10 +- dist/styles/angular-patternfly.min.css | 2 +- src/utils/transclude-directive.js | 124 +++++++++++++++++++ src/views/datalist/data-list-directive.js | 13 +- src/views/datalist/data-list.html | 2 +- src/views/views.module.js | 2 +- styles/angular-patternfly.css | 10 +- 9 files changed, 276 insertions(+), 30 deletions(-) diff --git a/dist/angular-patternfly.js b/dist/angular-patternfly.js index 406df5c69..8aa4a2e79 100644 --- a/dist/angular-patternfly.js +++ b/dist/angular-patternfly.js @@ -48,7 +48,7 @@ angular.module( 'patternfly.utils', [] ); * Views module for patternfly. * */ -angular.module('patternfly.views', []); +angular.module('patternfly.views', ['patternfly.utils']); ;/** * @ngdoc directive * @name patternfly.autofocus:pfFocused @@ -1991,6 +1991,130 @@ angular.module('patternfly.select', []).directive('pfSelect', function ($timeout }; }); ; +/** + * @ngdoc directive + * @name patternfly.utils.directive:pfTransclude + * @restrict A + * @element ANY + * @param {string} pfTransclude specifies the type of transclusion to use.
+ * Values: + * + * + * @description + * Directive for transcluding in directives and setting up scope of children of parent directives. This is a workaround + * for https://github.com/angular/angular.js/issues/5489 + * + * @example + + + +
+ Here the scope id is: {{$id}} + + +
This content was transcluded using pf-transclude or pf-transclude="sibling".
Its scope is: {{$id}} the parent of which is {{$parent.$id}}
+
+ + +
This content was transcluded using pf-transclude="parent".
Its scope is: {{$id}} the parent of which is {{$parent.$id}}
+
+ + +
This content was transcluded using pf-transclude="child".
Its scope is: {{$id}} the parent of which is {{$parent.$id}}
+
+
+
+ + + angular.module('patternfly.utils') + .controller( 'UtilCtrl', function($scope) { + + }) + + .config(function($provide){ + $provide.decorator('ngTranscludeDirective', ['$delegate', function($delegate) { + // Remove the original directive + $delegate.shift(); + return $delegate; + }]); + }) + + .directive( 'transcludeSibling', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + template: + '
' + + '

I am a directive with scope {{$id}}

' + + '' + + '
' + } + }) + + .directive( 'transcludeParent', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + template: + '
' + + '

I am a directive with scope {{$id}}

' + + '' + + '
' + } + }) + + .directive( 'transcludeChild', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + template: + '
' + + '

I am a directive with scope {{$id}}

' + + '' + + '
' + } + }) + ; +
+
+ */ angular .module('patternfly.utils').directive('pfTransclude', function () { 'use strict'; @@ -2212,7 +2336,7 @@ angular.module('patternfly.validation', []).directive('pfValidation', function ( * Directive for rendering a data list. *

* - * @param {object} config configuration settings for the sparkline chart:
+ * @param {object} config configuration settings for the data list:
*