@@ -11217,8 +11217,8 @@ angular.module('patternfly.notification').component('pfNotificationList', {
11217
11217
* @param {Array} notifications The list of current notifications to display. Each notification should have the following (see pfToastNotification):
11218
11218
* <ul style='list-style-type: none'>
11219
11219
* <li>.type - (String) The type of the notification message. Allowed value is one of these: 'success','info','danger', 'warning'
11220
- * <li>.header - (String) The header to display for the notification (optional)
11221
- * <li>.message - (String) The main text message of the notification.
11220
+ * <li>.header - (String) The header to display for the notification, accepts HTML content when allowed. (optional)
11221
+ * <li>.message - (String) The main text message of the notification. Accepts HTML content when allowed.
11222
11222
* <li>.actionTitle Text to show for the primary action, optional.
11223
11223
* <li>.actionCallback (function(this notification)) Function to invoke when primary action is selected, optional
11224
11224
* <li>.menuActions Optional list of actions to place in the kebab menu:<br/>
@@ -11231,6 +11231,7 @@ angular.module('patternfly.notification').component('pfNotificationList', {
11231
11231
* <li>.isPersistent Flag to show close button for the notification even if showClose is false.
11232
11232
* </ul>
11233
11233
* @param {Boolean} showClose Flag to show the close button on all notifications (not shown if the notification has menu actions)
11234
+ * @param {Boolean} htmlContent Flag to allow HTML content within the header and message options.
11234
11235
* @param {function} closeCallback (function(data)) Function to invoke when closes a toast notification
11235
11236
* @param {function} updateViewing (function(boolean, data)) Function to invoke when user is viewing/not-viewing (hovering on) a toast notification
11236
11237
*
@@ -11242,7 +11243,7 @@ angular.module('patternfly.notification').component('pfNotificationList', {
11242
11243
11243
11244
<file name="index.html">
11244
11245
<div ng-controller="ToastNotificationListDemoCtrl" >
11245
- <pf-toast-notification-list notifications="notifications" show-close="showClose" close-callback="handleClose" update-viewing="updateViewing"></pf-toast-notification-list>
11246
+ <pf-toast-notification-list notifications="notifications" show-close="showClose" html-content="htmlContent" close-callback="handleClose" update-viewing="updateViewing"></pf-toast-notification-list>
11246
11247
<div class="row example-container">
11247
11248
<div class="col-md-12">
11248
11249
<form class="form-horizontal">
@@ -11294,9 +11295,13 @@ angular.module('patternfly.notification').component('pfNotificationList', {
11294
11295
<input type="checkbox" ng-model="persistent"/>
11295
11296
</div>
11296
11297
<label class="col-sm-2 control-label" for="type">Show Menu:</label>
11297
- <div class="col-sm-2 ">
11298
+ <div class="col-sm-1 ">
11298
11299
<input type="checkbox" ng-model="showMenu"/>
11299
11300
</div>
11301
+ <label class="col-sm-2 control-label" for="type">Allow HTML:</label>
11302
+ <div class="col-sm-1">
11303
+ <input type="checkbox" ng-model="htmlContent"/>
11304
+ </div>
11300
11305
</div>
11301
11306
<div class="form-group">
11302
11307
<div class="col-sm-12">
@@ -11328,8 +11333,9 @@ angular.module('patternfly.notification').component('pfNotificationList', {
11328
11333
11329
11334
$scope.type = $scope.types[0];
11330
11335
$scope.header = 'Default header.';
11331
- $scope.message = 'Default notification message.';
11336
+ $scope.message = 'Default <strong> notification</strong> message.';
11332
11337
$scope.showClose = false;
11338
+ $scope.htmlContent = false;
11333
11339
$scope.persistent = false;
11334
11340
11335
11341
$scope.primaryAction = '';
@@ -11403,7 +11409,7 @@ angular.module('patternfly.notification').component('pfNotificationList', {
11403
11409
$scope.handleAction,
11404
11410
($scope.showMenu ? $scope.menuActions : undefined)
11405
11411
);
11406
- }
11412
+ };
11407
11413
11408
11414
$scope.notifications = Notifications.data;
11409
11415
});
@@ -11415,6 +11421,7 @@ angular.module('patternfly.notification').component('pfToastNotificationList', {
11415
11421
bindings: {
11416
11422
notifications: '=',
11417
11423
showClose: '=?',
11424
+ htmlContent: '<?',
11418
11425
closeCallback: '=?',
11419
11426
updateViewing: '=?'
11420
11427
},
@@ -11435,16 +11442,18 @@ angular.module('patternfly.notification').component('pfToastNotificationList', {
11435
11442
};
11436
11443
}
11437
11444
});
11445
+
11438
11446
;/**
11439
11447
* @ngdoc directive
11440
11448
* @name patternfly.notification.component:pfToastNotification
11441
11449
* @restrict E
11442
11450
* @scope
11443
11451
*
11444
11452
* @param {string} notificationType The type of the notification message. Allowed value is one of these: 'success','info','danger', 'warning'
11445
- * @param {string} header The header text of the notification.
11446
- * @param {string} message The main text message of the notification.
11453
+ * @param {string} header The header text of the notification. Accepts HTML content when allowed.
11454
+ * @param {string} message The main text message of the notification. Accepts HTML content when allowed.
11447
11455
* @param {boolean} showClose Flag to show the close button, default: true
11456
+ * @param {boolean} htmlContent Flag to allow HTML content within the header and message options.
11448
11457
* @param {function} closeCallback (function(data)) Function to invoke when close action is selected, optional
11449
11458
* @param {string} actionTitle Text to show for the primary action, optional.
11450
11459
* @param {function} actionCallback (function(data)) Function to invoke when primary action is selected, optional
@@ -11474,9 +11483,9 @@ angular.module('patternfly.notification').component('pfToastNotificationList', {
11474
11483
<div ng-controller="ToastNotificationDemoCtrl" class="row example-container">
11475
11484
<div class="col-md-12">
11476
11485
<pf-toast-notification notification-type="{{type}}" header="{{header}}" message="{{message}}"
11477
- show-close="{{showClose}}" close-callback="closeCallback "
11478
- action-title="{{primaryAction}}" action-callback="handleAction "
11479
- menu-actions="menuActions">
11486
+ show-close="{{showClose}}" html-content="htmlContent "
11487
+ close-callback="closeCallback" action-title="{{primaryAction}}"
11488
+ action-callback="handleAction" menu-actions="menuActions">
11480
11489
</pf-toast-notification>
11481
11490
11482
11491
<form class="form-horizontal">
@@ -11518,13 +11527,17 @@ angular.module('patternfly.notification').component('pfToastNotificationList', {
11518
11527
</div>
11519
11528
<div class="form-group">
11520
11529
<label class="col-sm-2 control-label" for="type">Show Close:</label>
11521
- <div class="col-sm-3 ">
11530
+ <div class="col-sm-1 ">
11522
11531
<input type="checkbox" ng-model="showClose"/>
11523
11532
</div>
11524
11533
<label class="col-sm-2 control-label" for="type">Show Menu:</label>
11525
- <div class="col-sm-3 ">
11534
+ <div class="col-sm-1 ">
11526
11535
<input type="checkbox" ng-model="showMenu"/>
11527
11536
</div>
11537
+ <label class="col-sm-2 control-label" for="type">Allow HTML:</label>
11538
+ <div class="col-sm-1">
11539
+ <input type="checkbox" ng-model="htmlContent"/>
11540
+ </div>
11528
11541
</div>
11529
11542
</form>
11530
11543
</div>
@@ -11542,9 +11555,10 @@ angular.module('patternfly.notification').component('pfToastNotificationList', {
11542
11555
$scope.types = ['success','info','danger', 'warning'];
11543
11556
$scope.type = $scope.types[0];
11544
11557
$scope.showClose = false;
11558
+ $scope.htmlContent = false;
11545
11559
11546
11560
$scope.header = 'Default Header.';
11547
- $scope.message = 'Default Message .';
11561
+ $scope.message = 'Default <strong>notification</strong> message .';
11548
11562
$scope.primaryAction = '';
11549
11563
11550
11564
$scope.updateType = function(item) {
@@ -11619,6 +11633,7 @@ angular.module( 'patternfly.notification' ).component('pfToastNotification', {
11619
11633
'message': '@',
11620
11634
'header': '@',
11621
11635
'showClose': '@',
11636
+ 'htmlContent': '<?',
11622
11637
'closeCallback': '=?',
11623
11638
'actionTitle': '@',
11624
11639
'actionCallback': '=?',
@@ -11627,7 +11642,7 @@ angular.module( 'patternfly.notification' ).component('pfToastNotification', {
11627
11642
'data': '=?'
11628
11643
},
11629
11644
templateUrl: 'notification/toast-notification.html',
11630
- controller: function () {
11645
+ controller: ["$sce", function ($sce ) {
11631
11646
'use strict';
11632
11647
var ctrl = this,
11633
11648
_showClose;
@@ -11686,8 +11701,13 @@ angular.module( 'patternfly.notification' ).component('pfToastNotification', {
11686
11701
ctrl.updateShowClose();
11687
11702
}
11688
11703
};
11689
- }
11704
+
11705
+ ctrl.trustAsHtml = function (html) {
11706
+ return $sce.trustAsHtml(html);
11707
+ };
11708
+ }]
11690
11709
});
11710
+
11691
11711
;/**
11692
11712
* @ngdoc directive
11693
11713
* @name patternfly.pagination.component:pfPagination
@@ -18343,12 +18363,12 @@ angular.module('patternfly.wizard').component('pfWizard', {
18343
18363
18344
18364
18345
18365
$templateCache.put('notification/toast-notification-list.html',
18346
- "<div class=toast-notifications-list-pf data-ng-show=\"$ctrl.notifications.length > 0\"><div ng-repeat=\"notification in $ctrl.notifications\"><pf-toast-notification notification-type={{notification.type}} header={{notification.header}} message={{notification.message}} show-close=\"{{($ctrl.showClose || notification.isPersistent === true) && !(notification.menuActions && notification.menuActions.length > 0)}}\" close-callback=$ctrl.handleClose action-title={{notification.actionTitle}} action-callback=notification.actionCallback menu-actions=notification.menuActions update-viewing=$ctrl.handleViewingChange data=notification></pf-toast-notification></div></div>"
18366
+ "<div class=toast-notifications-list-pf data-ng-show=\"$ctrl.notifications.length > 0\"><div ng-repeat=\"notification in $ctrl.notifications\"><pf-toast-notification notification-type={{notification.type}} header={{notification.header}} message={{notification.message}} show-close=\"{{($ctrl.showClose || notification.isPersistent === true) && !(notification.menuActions && notification.menuActions.length > 0)}}\" html-content=$ctrl.htmlContent close-callback=$ctrl.handleClose action-title={{notification.actionTitle}} action-callback=notification.actionCallback menu-actions=notification.menuActions update-viewing=$ctrl.handleViewingChange data=notification></pf-toast-notification></div></div>"
18347
18367
);
18348
18368
18349
18369
18350
18370
$templateCache.put('notification/toast-notification.html',
18351
- "<div class=\"toast-pf alert alert-{{$ctrl.notificationType}}\" ng-class=\"{'alert-dismissable': $ctrl.showCloseButton}\" ng-mouseenter=$ctrl.handleEnter() ng-mouseleave=$ctrl.handleLeave()><div uib-dropdown class=\"pull-right dropdown-kebab-pf\" ng-if=\"$ctrl.menuActions && $ctrl.menuActions.length > 0\"><button uib-dropdown-toggle class=\"btn btn-link\" type=button id=dropdownKebabRight><span class=\"fa fa-ellipsis-v\"></span></button><ul uib-dropdown-menu class=dropdown-menu-right aria-labelledby=dropdownKebabRight><li ng-repeat=\"menuAction in $ctrl.menuActions\" role=\"{{menuAction.isSeparator === true ? 'separator' : 'menuitem'}}\" ng-class=\"{'divider': menuAction.isSeparator === true, 'disabled': menuAction.isDisabled === true}\"><a ng-if=\"menuAction.isSeparator !== true\" class=secondary-action title={{menuAction.title}} ng-click=$ctrl.handleMenuAction(menuAction)>{{menuAction.name}}</a></li></ul></div><button ng-if=$ctrl.showCloseButton type=button class=close aria-hidden=true ng-click=$ctrl.handleClose()><span class=\"pficon pficon-close\"></span></button><div class=\"pull-right toast-pf-action\" ng-if=$ctrl.actionTitle><a ng-click=$ctrl.handleAction()>{{$ctrl.actionTitle}}</a></div><span class=\"pficon pficon-ok\" ng-if=\"$ctrl.notificationType === 'success'\"></span> <span class=\"pficon pficon-info\" ng-if=\"$ctrl.notificationType === 'info'\"></span> <span class=\"pficon pficon-error-circle-o\" ng-if=\"$ctrl.notificationType === 'danger'\"></span> <span class=\"pficon pficon-warning-triangle-o\" ng-if=\"$ctrl.notificationType === 'warning'\"></span> <span ng-if=$ctrl.header><strong>{{$ctrl.header}}</strong> {{$ctrl.message}}</span> <span ng-if=!$ctrl.header>{{$ctrl.message}}</span></div>"
18371
+ "<div class=\"toast-pf alert alert-{{$ctrl.notificationType}}\" ng-class=\"{'alert-dismissable': $ctrl.showCloseButton}\" ng-mouseenter=$ctrl.handleEnter() ng-mouseleave=$ctrl.handleLeave()><div uib-dropdown class=\"pull-right dropdown-kebab-pf\" ng-if=\"$ctrl.menuActions && $ctrl.menuActions.length > 0\"><button uib-dropdown-toggle class=\"btn btn-link\" type=button id=dropdownKebabRight><span class=\"fa fa-ellipsis-v\"></span></button><ul uib-dropdown-menu class=dropdown-menu-right aria-labelledby=dropdownKebabRight><li ng-repeat=\"menuAction in $ctrl.menuActions\" role=\"{{menuAction.isSeparator === true ? 'separator' : 'menuitem'}}\" ng-class=\"{'divider': menuAction.isSeparator === true, 'disabled': menuAction.isDisabled === true}\"><a ng-if=\"menuAction.isSeparator !== true\" class=secondary-action title={{menuAction.title}} ng-click=$ctrl.handleMenuAction(menuAction)>{{menuAction.name}}</a></li></ul></div><button ng-if=$ctrl.showCloseButton type=button class=close aria-hidden=true ng-click=$ctrl.handleClose()><span class=\"pficon pficon-close\"></span></button><div class=\"pull-right toast-pf-action\" ng-if=$ctrl.actionTitle><a ng-click=$ctrl.handleAction()>{{$ctrl.actionTitle}}</a></div><span class=\"pficon pficon-ok\" ng-if=\"$ctrl.notificationType === 'success'\"></span> <span class=\"pficon pficon-info\" ng-if=\"$ctrl.notificationType === 'info'\"></span> <span class=\"pficon pficon-error-circle-o\" ng-if=\"$ctrl.notificationType === 'danger'\"></span> <span class=\"pficon pficon-warning-triangle-o\" ng-if=\"$ctrl.notificationType === 'warning'\"></span> <span ng-if=!$ctrl.htmlContent><strong ng-if=$ctrl.header ng-bind=$ctrl.header></strong> <span ng-bind=$ctrl.message></span></span> <span ng-if=$ctrl.htmlContent><strong ng-if=$ctrl.header ng-bind-html=$ctrl.trustAsHtml($ctrl.header)></strong> <span ng-bind-html=$ctrl.trustAsHtml($ctrl.message)></span></span></div>"
18352
18372
);
18353
18373
18354
18374
}]);
0 commit comments