summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/flash.js
diff options
context:
space:
mode:
authorkushalpandya <kushal@gitlab.com>2017-05-25 14:18:10 +0530
committerJarka Kadlecova <jarka@gitlab.com>2017-06-01 07:47:15 +0200
commitc1ef4347ed2f2767e045f0d145092abd7d525465 (patch)
treebe21c9fc07db351571a3c3a36d87256cc21cb204 /app/assets/javascripts/flash.js
parentf5f20274fa6b27b40182e4d1a2c7164f4ca51543 (diff)
downloadgitlab-ce-c1ef4347ed2f2767e045f0d145092abd7d525465.tar.gz
Add support for action links
Diffstat (limited to 'app/assets/javascripts/flash.js')
-rw-r--r--app/assets/javascripts/flash.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js
index eec30624ff2..4d00858f7e8 100644
--- a/app/assets/javascripts/flash.js
+++ b/app/assets/javascripts/flash.js
@@ -7,8 +7,8 @@ window.Flash = (function() {
return $(this).fadeOut();
};
- function Flash(message, type, parent) {
- var flash, textDiv;
+ function Flash(message, type, parent, actionConfig) {
+ var flash, textDiv, actionLink;
if (type == null) {
type = 'alert';
}
@@ -30,6 +30,17 @@ window.Flash = (function() {
text: message
});
textDiv.appendTo(flash);
+
+ if (actionConfig) {
+ actionLink = $('<a/>', {
+ "class": "flash-action",
+ "href": "#",
+ text: actionConfig.title
+ });
+
+ actionLink.appendTo(flash);
+ this.flashContainer.on('click', '.flash-action', actionConfig.clickHandler);
+ }
if (this.flashContainer.parent().hasClass('content-wrapper')) {
textDiv.addClass('container-fluid container-limited');
}