Skip to content

Commit

Permalink
Issue kimchi-project#9: Making wok.message closeable even if containe…
Browse files Browse the repository at this point in the history
…r/node for message is given.

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@linux.vnet.ibm.com>
  • Loading branch information
Archana Singh authored and alinefm committed Dec 16, 2015
1 parent 563d211 commit be82c24
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ui/js/src/wok.message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
};

0 comments on commit be82c24

Please sign in to comment.