debian-mirror-gitlab/app/assets/javascripts/flash.js.coffee

29 lines
650 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
class @Flash
2016-08-24 12:49:21 +05:30
hideFlash = -> $(@).fadeOut()
2014-09-02 18:07:02 +05:30
2016-08-24 12:49:21 +05:30
constructor: (message, type = 'alert', parent = null)->
if parent
@flashContainer = parent.find('.flash-container')
else
@flashContainer = $('.flash-container-page')
@flashContainer.html('')
flash = $('<div/>',
class: "flash-#{type}"
)
flash.on 'click', hideFlash
textDiv = $('<div/>',
class: 'flash-text',
2014-09-02 18:07:02 +05:30
text: message
2015-12-23 02:04:40 +05:30
)
2016-08-24 12:49:21 +05:30
textDiv.appendTo(flash)
if @flashContainer.parent().hasClass('content-wrapper')
textDiv.addClass('container-fluid container-limited')
2014-09-02 18:07:02 +05:30
2016-08-24 12:49:21 +05:30
flash.appendTo(@flashContainer)
@flashContainer.show()
2015-12-23 02:04:40 +05:30