[Kimchi-devel] [PATCH ][Wok] Issue # 156 : Wok success message is not disappearing automatically.

atreyee at linux.vnet.ibm.com atreyee at linux.vnet.ibm.com
Fri Aug 12 09:04:14 UTC 2016


From: Atreyee Mukhopadhyay <atreyee at linux.vnet.ibm.com>

Making closable parameter configurable for Success, error,warn and
notify method instead of making it default true.
---
 ui/js/src/wok.message.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ui/js/src/wok.message.js b/ui/js/src/wok.message.js
index 159dc36..1c07466 100644
--- a/ui/js/src/wok.message.js
+++ b/ui/js/src/wok.message.js
@@ -20,14 +20,13 @@
 
 wok.message = function(msg, level, node, closeable, onclick, alertId) {
     "use strict";
-    var close = closeable || true;
     var container = node || $('#alert-fields');
     if($("#" + alertId).length === 0) {
         if ($(container).size() < 1) {
             container = $('<div id="alert-fields"/>').appendTo($('#alert-container'));
         }
         var message = '<div '+( alertId ? 'id="'+alertId+'"' : '')+' role="alert" class="alert ' + (level || '') + ' '+( close ? 'alert-dismissible' : '')+' fade in" style="display: none;">';
-        if(!node || close) {
+        if(!node || closeable) {
             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;
@@ -38,7 +37,7 @@ wok.message = function(msg, level, node, closeable, onclick, alertId) {
         $message.alert();
         $message.fadeIn(100);
 
-        if(!close){
+        if(!closeable){
             var timeout = setTimeout(function() {
                 $message.delay(4000).fadeOut(100, function() {
                     $message.alert('close');
@@ -54,22 +53,27 @@ wok.message = function(msg, level, node, closeable, onclick, alertId) {
 
 wok.message.warn = function(msg, node, closeable, alertId) {
     "use strict";
+    closeable =  closeable || true;
     wok.message(msg, 'alert-warning', node, closeable, null, alertId);
 };
 wok.message.error = function(msg, node, closeable, alertId) {
     "use strict";
+    closeable =  closeable || true;
     wok.message(msg, 'alert-danger', node, closeable, null, alertId);
 };
 wok.message.error.code = function(code, node, closeable, alertId) {
     "use strict";
     var msg = code + ": " + i18n[code];
+    closeable =  closeable || true;
     wok.message(msg, 'alert-danger', node, closeable, null, alertId);
 };
 wok.message.success = function(msg, node, closeable, alertId) {
     "use strict";
+    closeable =  closeable || false;
     wok.message(msg, 'alert-success', node, closeable, null, alertId);
 };
 wok.message.notify = function(notification, node) {
     "use strict";
+    closeable =  closeable || true;
     wok.message(notification.message, 'alert-warning', node, true, "wok.removeNotification('" + notification.code + "')");
 };
-- 
2.1.0




More information about the Kimchi-devel mailing list