From a6fb7312fced5f2095521ee6730b25134e5e529a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Fri, 30 May 2014 12:37:49 +0200 Subject: [PATCH 1/5] Added icon support. --- demo.html | 1 + jquery.bootstrap-growl.coffee | 7 +++++-- jquery.bootstrap-growl.js | 16 +++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/demo.html b/demo.html index bb69378..aeaffa2 100644 --- a/demo.html +++ b/demo.html @@ -21,6 +21,7 @@ setTimeout(function() { $.bootstrapGrowl("Danger, Danger!", { + icon: 'glyphicon glyphicon-info-sign', type: 'danger', align: 'center', width: 'auto', diff --git a/jquery.bootstrap-growl.coffee b/jquery.bootstrap-growl.coffee index 6ea1be1..8b13ed2 100644 --- a/jquery.bootstrap-growl.coffee +++ b/jquery.bootstrap-growl.coffee @@ -8,7 +8,10 @@ $.bootstrapGrowl = (message, options) -> $alert = $("
") $alert.attr "class", "bootstrap-growl alert" $alert.addClass "alert-" + options.type if options.type - $alert.append "×" if options.allow_dismiss + if options.icon + $alert.append " " + if options.allow_dismiss + $alert.append "×" if options.allow_dismiss $alert.append message # Prevent BC breaks @@ -64,7 +67,7 @@ $.bootstrapGrowl.default_options = amount: 20 align: "right" # (left, right, or center) width: 250 - delay: 4000 + delay: -1 allow_dismiss: true stackup_spacing: 10 diff --git a/jquery.bootstrap-growl.js b/jquery.bootstrap-growl.js index edc220f..04ae96a 100644 --- a/jquery.bootstrap-growl.js +++ b/jquery.bootstrap-growl.js @@ -5,15 +5,15 @@ $.bootstrapGrowl = function(message, options) { var $alert, css, offsetAmount; - options = $.extend({}, $.bootstrapGrowl.default_options, options); $alert = $("
"); $alert.attr("class", "bootstrap-growl alert"); - if (options.type) { - $alert.addClass("alert-" + options.type); - } + if (options.type) $alert.addClass("alert-" + options.type); + if (options.icon) $alert.append(" "); if (options.allow_dismiss) { - $alert.append("×"); + if (options.allow_dismiss) { + $alert.append("×"); + } } $alert.append(message); if (options.top_offset) { @@ -34,9 +34,7 @@ }; css[options.offset.from] = offsetAmount + "px"; $alert.css(css); - if (options.width !== "auto") { - $alert.css("width", options.width + "px"); - } + if (options.width !== "auto") $alert.css("width", options.width + "px"); $(options.ele).append($alert); switch (options.align) { case "center": @@ -69,7 +67,7 @@ }, align: "right", width: 250, - delay: 4000, + delay: -1, allow_dismiss: true, stackup_spacing: 10 }; From bef13ec66c307a46037e469152c3b6693b8b1056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Fri, 30 May 2014 12:42:44 +0200 Subject: [PATCH 2/5] Added icon support 2 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6cecfca..208636b 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ By default, growls use the standard 'alert' Bootstrap style, are 250px wide, rig ```javascript $.bootstrapGrowl("another message, yay!", { ele: 'body', // which element to append to + icon: 'glyphicon glyphicon-info-sign' // Use Bootstrap of FontAwsome icons type: 'info', // (null, 'info', 'error', 'success') offset: {from: 'top', amount: 20}, // 'top', or 'bottom' align: 'right', // ('left', 'right', or 'center') From af265bc4f3ee6ff797c1b7b1ebba826c580e41f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Fri, 30 May 2014 12:44:08 +0200 Subject: [PATCH 3/5] Added icon support --- .idea/bootstrap-growl-1.iml | 9 +++++++++ .idea/encodings.xml | 5 +++++ .idea/libraries/Generated_files.xml | 13 +++++++++++++ .idea/misc.xml | 5 +++++ .idea/modules.xml | 9 +++++++++ .idea/scopes/scope_settings.xml | 5 +++++ .idea/vcs.xml | 7 +++++++ .idea/watcherTasks.xml | 26 ++++++++++++++++++++++++++ jquery.bootstrap-growl.js | 2 +- 9 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 .idea/bootstrap-growl-1.iml create mode 100644 .idea/encodings.xml create mode 100644 .idea/libraries/Generated_files.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/watcherTasks.xml diff --git a/.idea/bootstrap-growl-1.iml b/.idea/bootstrap-growl-1.iml new file mode 100644 index 0000000..6b8184f --- /dev/null +++ b/.idea/bootstrap-growl-1.iml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/libraries/Generated_files.xml b/.idea/libraries/Generated_files.xml new file mode 100644 index 0000000..629b021 --- /dev/null +++ b/.idea/libraries/Generated_files.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1162f43 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2d4cd4c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c80f219 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 0000000..1501116 --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/jquery.bootstrap-growl.js b/jquery.bootstrap-growl.js index 04ae96a..793246b 100644 --- a/jquery.bootstrap-growl.js +++ b/jquery.bootstrap-growl.js @@ -67,7 +67,7 @@ }, align: "right", width: 250, - delay: -1, + delay: 4000, allow_dismiss: true, stackup_spacing: 10 }; From d33e7b39f9996f3ae5e65d8a76578a35b02aa284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Fri, 30 May 2014 12:45:51 +0200 Subject: [PATCH 4/5] Clean up --- .idea/bootstrap-growl-1.iml | 9 --------- .idea/encodings.xml | 5 ----- .idea/misc.xml | 5 ----- .idea/modules.xml | 9 --------- .idea/vcs.xml | 7 ------- .idea/watcherTasks.xml | 26 -------------------------- 6 files changed, 61 deletions(-) delete mode 100644 .idea/bootstrap-growl-1.iml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/watcherTasks.xml diff --git a/.idea/bootstrap-growl-1.iml b/.idea/bootstrap-growl-1.iml deleted file mode 100644 index 6b8184f..0000000 --- a/.idea/bootstrap-growl-1.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index e206d70..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 1162f43..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2d4cd4c..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index c80f219..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml deleted file mode 100644 index 1501116..0000000 --- a/.idea/watcherTasks.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - From 9df496bc913df43b465e0a32ca291190bff54320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Fri, 30 May 2014 13:15:03 +0200 Subject: [PATCH 5/5] Cleanup --- .idea/libraries/Generated_files.xml | 13 ------------- .idea/scopes/scope_settings.xml | 5 ----- 2 files changed, 18 deletions(-) delete mode 100644 .idea/libraries/Generated_files.xml delete mode 100644 .idea/scopes/scope_settings.xml diff --git a/.idea/libraries/Generated_files.xml b/.idea/libraries/Generated_files.xml deleted file mode 100644 index 629b021..0000000 --- a/.idea/libraries/Generated_files.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b..0000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file