BigW Consortium Gitlab

flash.js.coffee 354 Bytes
Newer Older
1
class @Flash
Alfredo Sumaran committed
2
  constructor: (message, type = 'alert')->
3 4
    @flash = $(".flash-container")
    @flash.html("")
5

6
    innerDiv = $('<div/>',
7 8
      class: "flash-#{type}",
      text: message
9 10
    )
    innerDiv.appendTo(".flash-container")
11

12 13 14
    @flash.click -> $(@).fadeOut()
    @flash.show()

15 16
  pinTo: (selector) ->
    @flash.detach().appendTo(selector)