From: Archana Singh <archus(a)linux.vnet.ibm.com>
Modified code to have one more paramter as closeable, if passed
with value as true then it add the close button to message node.
Otherwise if not passed or passed with value false then
there is no change in previous behaviour.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
ui/js/src/wok.message.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ui/js/src/wok.message.js b/ui/js/src/wok.message.js
index c74101e..5f5759e 100644
--- a/ui/js/src/wok.message.js
+++ b/ui/js/src/wok.message.js
@@ -18,14 +18,14 @@
* limitations under the License.
*/
-wok.message = function(msg, level, node) {
+wok.message = function(msg, level, node, closeable) {
"use strict";
var container = node || $('#alert-fields');
if ($(container).size() < 1) {
container = $('<div
id="alert-fields"/>').appendTo($('#alert-container'));
}
var message = '<div role="alert" class="alert ' + (level ||
'') + ' alert-dismissible fade in" style="display:
none;">';
- if(!node) {
+ 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 += msg;
@@ -47,20 +47,20 @@ wok.message = function(msg, level, node) {
}, 10000);
};
-wok.message.warn = function(msg, node) {
+wok.message.warn = function(msg, node, closeable) {
"use strict";
- wok.message(msg, 'alert-warning', node);
+ wok.message(msg, 'alert-warning', node, closeable);
};
-wok.message.error = function(msg, node) {
+wok.message.error = function(msg, node, closeable) {
"use strict";
- wok.message(msg, 'alert-danger', node);
+ wok.message(msg, 'alert-danger', node, closeable);
};
wok.message.error.code = function(code) {
"use strict";
var msg = code + ": " + i18n[code];
wok.message(msg, 'alert-danger');
};
-wok.message.success = function(msg, node) {
+wok.message.success = function(msg, node, closeable) {
"use strict";
- wok.message(msg, 'alert-success', node);
+ wok.message(msg, 'alert-success', node, closeable);
};
--
2.1.0
Show replies by date
Applied. Thanks.
Regards,
Aline Manera