Add new features to javascript flash message

This commit is contained in:
Grzegorz Bizon 2015-12-03 08:51:14 +01:00
parent 6fc1b94856
commit 70a076c059
2 changed files with 23 additions and 6 deletions

View file

@ -1,12 +1,19 @@
class @Flash
constructor: (message, type)->
flash = $(".flash-container")
flash.html("")
@flash = $(".flash-container")
@flash.html("")
$('<div/>',
innerDiv = $('<div/>',
class: "flash-#{type}",
text: message
).appendTo(".flash-container")
)
innerDiv.appendTo(".flash-container")
flash.click -> $(@).fadeOut()
flash.show()
@flash.click -> $(@).fadeOut()
@flash.show()
pinToTop: ->
@flash.addClass('flash-pinned')
raise: ->
@flash.addClass('flash-raised')

View file

@ -15,3 +15,13 @@
@extend .alert-danger;
}
}
.flash-pinned {
position: fixed;
top: 80px;
width: 80%;
}
.flash-raised {
z-index: 1000;
}