gitlab-org--gitlab-foss/app/assets/javascripts/flash.js.coffee
Grzegorz Bizon d1211e0ada Fix award-emojis alert flash message
This adds a new feature to `Flash` that allows to pin it after a
specified selector. This removes a fixed position from such award-emoji
alert, and makes it responsive by design of selector that this alert is
pinned to.

Closes #3996
2015-12-11 13:50:14 +01:00

16 lines
344 B
CoffeeScript

class @Flash
constructor: (message, type)->
@flash = $(".flash-container")
@flash.html("")
innerDiv = $('<div/>',
class: "flash-#{type}",
text: message
)
innerDiv.appendTo(".flash-container")
@flash.click -> $(@).fadeOut()
@flash.show()
pinTo: (selector) ->
@flash.detach().appendTo(selector)