summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-03 08:51:14 +0100
committerGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-03 13:39:00 +0100
commit70a076c059482e5c26cb723b722bc865142460ea (patch)
tree49a0b003246fd457d2aa7131bad101b2e6d3aa68
parent6fc1b948560b9e19ac5c1412dd2deb98987aefe8 (diff)
downloadgitlab-ce-70a076c059482e5c26cb723b722bc865142460ea.tar.gz
Add new features to javascript flash message
-rw-r--r--app/assets/javascripts/flash.js.coffee19
-rw-r--r--app/assets/stylesheets/framework/flash.scss10
2 files changed, 23 insertions, 6 deletions
diff --git a/app/assets/javascripts/flash.js.coffee b/app/assets/javascripts/flash.js.coffee
index b39ab0c4475..5e34b49c20d 100644
--- a/app/assets/javascripts/flash.js.coffee
+++ b/app/assets/javascripts/flash.js.coffee
@@ -1,12 +1,19 @@
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()
+
+ pinToTop: ->
+ @flash.addClass('flash-pinned')
+
+ raise: ->
+ @flash.addClass('flash-raised')
diff --git a/app/assets/stylesheets/framework/flash.scss b/app/assets/stylesheets/framework/flash.scss
index 82eb50ad4be..1b723021d76 100644
--- a/app/assets/stylesheets/framework/flash.scss
+++ b/app/assets/stylesheets/framework/flash.scss
@@ -15,3 +15,13 @@
@extend .alert-danger;
}
}
+
+.flash-pinned {
+ position: fixed;
+ top: 80px;
+ width: 80%;
+}
+
+.flash-raised {
+ z-index: 1000;
+}