[Kimchi-devel] [PATCH] [Wok 2/3] Implement wok.message.notify

Lucio Correia luciojhc at linux.vnet.ibm.com
Mon Apr 4 19:24:35 UTC 2016


 * add onclick parameter to wok.message for handling click on
close button
 * create wok.message.notify to show notifications

Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 ui/js/src/wok.message.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ui/js/src/wok.message.js b/ui/js/src/wok.message.js
index b74d188..e4c2ebd 100644
--- a/ui/js/src/wok.message.js
+++ b/ui/js/src/wok.message.js
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 
-wok.message = function(msg, level, node, closeable) {
+wok.message = function(msg, level, node, closeable, onclick) {
     "use strict";
     var container = node || $('#alert-fields');
     if ($(container).size() < 1) {
@@ -26,7 +26,7 @@ wok.message = function(msg, level, node, closeable) {
     }
     var message = '<div role="alert" class="alert ' + (level || '') + ' alert-dismissible fade in" style="display: none;">';
     if(!node || closeable) {
-        message += '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times-circle"></i></span></button>';
+        message += '<button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="' + (onclick || '') + '"><span aria-hidden="true"><i class="fa fa-times-circle"></i></span></button>';
     }
     message += msg;
     message += '</div>';
@@ -66,3 +66,7 @@ wok.message.success = function(msg, node, closeable) {
     "use strict";
     wok.message(msg, 'alert-success', node, closeable);
 };
+wok.message.notify = function(notification, node) {
+    "use strict";
+    wok.message(notification.message, 'alert-warning', node, true, "wok.removeNotification('" + notification.code + "')");
+};
-- 
1.9.1




More information about the Kimchi-devel mailing list