OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 /** | 3 /** |
4 * Provide the notification classes. | 4 * Provide the notification classes. |
5 * | 5 * |
6 * @module views | 6 * @module views |
7 * @submodule views.notifications | 7 * @submodule views.notifications |
8 */ | 8 */ |
9 | 9 |
10 YUI.add('juju-notifications', function(Y) { | 10 YUI.add('juju-notifications', function(Y) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 * @return {undefined} Mutates only. | 53 * @return {undefined} Mutates only. |
54 */ | 54 */ |
55 addNotifier: function(ev) { | 55 addNotifier: function(ev) { |
56 var notification = ev.model, | 56 var notification = ev.model, |
57 notifierBox = Y.one('#notifier-box'); | 57 notifierBox = Y.one('#notifier-box'); |
58 // Show error notifications only if the DOM contain the notifier box. | 58 // Show error notifications only if the DOM contain the notifier box. |
59 if (notifierBox && | 59 if (notifierBox && |
60 !notification.get('isDelta') && | 60 !notification.get('isDelta') && |
61 (notification.get('level') === 'error' || | 61 (notification.get('level') === 'error' || |
62 notification.get('level') === 'important')) { | 62 notification.get('level') === 'important')) { |
| 63 var msg = notification.get('message'); |
| 64 if (msg) { |
| 65 msg = new Y.Handlebars.SafeString(msg); |
| 66 } |
63 new widgets.Notifier({ | 67 new widgets.Notifier({ |
64 title: notification.get('title'), | 68 title: notification.get('title'), |
65 message: notification.get('message') | 69 message: msg |
66 }).render(notifierBox); | 70 }).render(notifierBox); |
67 } | 71 } |
68 }, | 72 }, |
69 | 73 |
70 /** | 74 /** |
71 * Event handler for clicking the notification icon. | 75 * Event handler for clicking the notification icon. |
72 * | 76 * |
73 * @method notifyToggle | 77 * @method notifyToggle |
74 */ | 78 */ |
75 notifyToggle: function(evt) { | 79 notifyToggle: function(evt) { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 314 |
311 }, '0.1.0', { | 315 }, '0.1.0', { |
312 requires: [ | 316 requires: [ |
313 'view', | 317 'view', |
314 'juju-view-utils', | 318 'juju-view-utils', |
315 'node', | 319 'node', |
316 'handlebars', | 320 'handlebars', |
317 'notifier' | 321 'notifier' |
318 ] | 322 ] |
319 }); | 323 }); |
OLD | NEW |