diff options
author | kushalpandya <kushal@gitlab.com> | 2017-05-25 14:18:10 +0530 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-06-01 07:47:15 +0200 |
commit | c1ef4347ed2f2767e045f0d145092abd7d525465 (patch) | |
tree | be21c9fc07db351571a3c3a36d87256cc21cb204 /app/assets | |
parent | f5f20274fa6b27b40182e4d1a2c7164f4ca51543 (diff) | |
download | gitlab-ce-c1ef4347ed2f2767e045f0d145092abd7d525465.tar.gz |
Add support for action links
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/flash.js | 15 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/flash.scss | 16 |
2 files changed, 29 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'); } diff --git a/app/assets/stylesheets/framework/flash.scss b/app/assets/stylesheets/framework/flash.scss index 25b4feca3c3..38d884bc7eb 100644 --- a/app/assets/stylesheets/framework/flash.scss +++ b/app/assets/stylesheets/framework/flash.scss @@ -16,6 +16,22 @@ @extend .alert; @extend .alert-danger; margin: 0; + + .flash-text, + .flash-action { + display: inline-block; + } + + a.flash-action { + margin-left: 5px; + text-decoration: none; + font-weight: normal; + border-bottom: 1px solid; + + &:hover { + border-color: transparent; + } + } } .flash-notice, |