Commit c1ef4347 authored by kushalpandya's avatar kushalpandya Committed by Jarka Kadlecova

Add support for action links

parent f5f20274
...@@ -7,8 +7,8 @@ window.Flash = (function() { ...@@ -7,8 +7,8 @@ window.Flash = (function() {
return $(this).fadeOut(); return $(this).fadeOut();
}; };
function Flash(message, type, parent) { function Flash(message, type, parent, actionConfig) {
var flash, textDiv; var flash, textDiv, actionLink;
if (type == null) { if (type == null) {
type = 'alert'; type = 'alert';
} }
...@@ -30,6 +30,17 @@ window.Flash = (function() { ...@@ -30,6 +30,17 @@ window.Flash = (function() {
text: message text: message
}); });
textDiv.appendTo(flash); 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')) { if (this.flashContainer.parent().hasClass('content-wrapper')) {
textDiv.addClass('container-fluid container-limited'); textDiv.addClass('container-fluid container-limited');
} }
......
...@@ -16,6 +16,22 @@ ...@@ -16,6 +16,22 @@
@extend .alert; @extend .alert;
@extend .alert-danger; @extend .alert-danger;
margin: 0; 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, .flash-notice,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment