2014-10-20 16:48:07 -04:00
|
|
|
class @Flash
|
2016-05-13 01:56:37 -04:00
|
|
|
constructor: (message, type = 'alert')->
|
2015-12-03 02:51:14 -05:00
|
|
|
@flash = $(".flash-container")
|
|
|
|
@flash.html("")
|
2013-08-27 05:18:53 -04:00
|
|
|
|
2015-12-03 02:51:14 -05:00
|
|
|
innerDiv = $('<div/>',
|
2013-08-27 05:18:53 -04:00
|
|
|
class: "flash-#{type}",
|
|
|
|
text: message
|
2015-12-03 02:51:14 -05:00
|
|
|
)
|
|
|
|
innerDiv.appendTo(".flash-container")
|
2013-08-27 05:18:53 -04:00
|
|
|
|
2015-12-03 02:51:14 -05:00
|
|
|
@flash.click -> $(@).fadeOut()
|
|
|
|
@flash.show()
|
|
|
|
|
2015-12-11 07:03:09 -05:00
|
|
|
pinTo: (selector) ->
|
|
|
|
@flash.detach().appendTo(selector)
|