Skip to content

Commit 5b1b6b7

Browse files
committed
DEV Notification List HTML Opt In
Option in for HTML content pass-through towards Notification component.
1 parent 71d481d commit 5b1b6b7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/notification/toast-notification-list.component.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* @param {Array} notifications The list of current notifications to display. Each notification should have the following (see pfToastNotification):
88
* <ul style='list-style-type: none'>
99
* <li>.type - (String) The type of the notification message. Allowed value is one of these: 'success','info','danger', 'warning'
10-
* <li>.header - (String) The header to display for the notification, accepts HTML content. (optional)
11-
* <li>.message - (String) The main text message of the notification. Accepts HTML content.
10+
* <li>.header - (String) The header to display for the notification, accepts HTML content when allowed. (optional)
11+
* <li>.message - (String) The main text message of the notification. Accepts HTML content when allowed.
1212
* <li>.actionTitle Text to show for the primary action, optional.
1313
* <li>.actionCallback (function(this notification)) Function to invoke when primary action is selected, optional
1414
* <li>.menuActions Optional list of actions to place in the kebab menu:<br/>
@@ -21,6 +21,7 @@
2121
* <li>.isPersistent Flag to show close button for the notification even if showClose is false.
2222
* </ul>
2323
* @param {Boolean} showClose Flag to show the close button on all notifications (not shown if the notification has menu actions)
24+
* @param {Boolean} htmlContent Flag to allow HTML content within the header and message options.
2425
* @param {function} closeCallback (function(data)) Function to invoke when closes a toast notification
2526
* @param {function} updateViewing (function(boolean, data)) Function to invoke when user is viewing/not-viewing (hovering on) a toast notification
2627
*
@@ -32,7 +33,7 @@
3233
3334
<file name="index.html">
3435
<div ng-controller="ToastNotificationListDemoCtrl" >
35-
<pf-toast-notification-list notifications="notifications" show-close="showClose" close-callback="handleClose" update-viewing="updateViewing"></pf-toast-notification-list>
36+
<pf-toast-notification-list notifications="notifications" show-close="showClose" html-content="htmlContent" close-callback="handleClose" update-viewing="updateViewing"></pf-toast-notification-list>
3637
<div class="row example-container">
3738
<div class="col-md-12">
3839
<form class="form-horizontal">
@@ -84,9 +85,13 @@
8485
<input type="checkbox" ng-model="persistent"/>
8586
</div>
8687
<label class="col-sm-2 control-label" for="type">Show Menu:</label>
87-
<div class="col-sm-2">
88+
<div class="col-sm-1">
8889
<input type="checkbox" ng-model="showMenu"/>
8990
</div>
91+
<label class="col-sm-2 control-label" for="type">Allow HTML:</label>
92+
<div class="col-sm-1">
93+
<input type="checkbox" ng-model="htmlContent"/>
94+
</div>
9095
</div>
9196
<div class="form-group">
9297
<div class="col-sm-12">
@@ -120,6 +125,7 @@
120125
$scope.header = 'Default header.';
121126
$scope.message = 'Default <strong>notification</strong> message.';
122127
$scope.showClose = false;
128+
$scope.htmlContent = false;
123129
$scope.persistent = false;
124130
125131
$scope.primaryAction = '';
@@ -205,6 +211,7 @@ angular.module('patternfly.notification').component('pfToastNotificationList', {
205211
bindings: {
206212
notifications: '=',
207213
showClose: '=?',
214+
htmlContent: '<?',
208215
closeCallback: '=?',
209216
updateViewing: '=?'
210217
},

src/notification/toast-notification-list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
header="{{notification.header}}"
55
message="{{notification.message}}"
66
show-close="{{($ctrl.showClose || notification.isPersistent === true) && !(notification.menuActions && notification.menuActions.length > 0)}}"
7+
html-content="$ctrl.htmlContent"
78
close-callback="$ctrl.handleClose"
89
action-title="{{notification.actionTitle}}"
910
action-callback="notification.actionCallback"

0 commit comments

Comments
 (0)