summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/flash.js.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/flash.js.coffee')
-rw-r--r--app/assets/javascripts/flash.js.coffee16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/flash.js.coffee b/app/assets/javascripts/flash.js.coffee
index b39ab0c4475..5de012e409f 100644
--- a/app/assets/javascripts/flash.js.coffee
+++ b/app/assets/javascripts/flash.js.coffee
@@ -1,12 +1,16 @@
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()
+
+ pinTo: (selector) ->
+ @flash.detach().appendTo(selector)