diff options
author | Fatih Acet <acetfatih@gmail.com> | 2019-07-19 00:35:49 +0200 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-08-26 11:53:09 +0300 |
commit | f3f1e781272ebf29681f804880bdd7e4fc34d5da (patch) | |
tree | 87c98de92afcc8badb9f790c602f10a0bb7b5c20 /app/assets/javascripts/flash.js | |
parent | 6ba51d692c3a6bac2ae82daac8bfd354f1f92999 (diff) | |
download | gitlab-ce-36765-flash-notification.tar.gz |
Make flash notifications sticky36765-flash-notification
This commit also unifies layout structure
and remove no_container flag
Diffstat (limited to 'app/assets/javascripts/flash.js')
-rw-r--r-- | app/assets/javascripts/flash.js | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js index c2397842125..660f0f0ba3e 100644 --- a/app/assets/javascripts/flash.js +++ b/app/assets/javascripts/flash.js @@ -1,4 +1,5 @@ import _ from 'underscore'; +import { spriteIcon } from './lib/utils/common_utils'; const hideFlash = (flashEl, fadeTransition = true) => { if (fadeTransition) { @@ -35,16 +36,11 @@ const createAction = config => ` </a> `; -const createFlashEl = (message, type, isFixedLayout = false) => ` - <div - class="flash-${type}" - > - <div - class="flash-text ${ - isFixedLayout ? 'container-fluid container-limited limit-container-width' : '' - }" - > +const createFlashEl = (message, type) => ` + <div class="flash-content flash-${type} rounded"> + <div class="flash-text"> ${_.escape(message)} + ${spriteIcon('close', 'close-icon')} </div> </div> `; @@ -76,15 +72,10 @@ const createFlash = function createFlash( addBodyClass = false, ) { const flashContainer = parent.querySelector('.flash-container'); - const navigation = parent.querySelector('.content'); if (!flashContainer) return null; - const isFixedLayout = navigation - ? navigation.parentNode.classList.contains('container-limited') - : true; - - flashContainer.innerHTML = createFlashEl(message, type, isFixedLayout); + flashContainer.innerHTML = createFlashEl(message, type); const flashEl = flashContainer.querySelector(`.flash-${type}`); removeFlashClickListener(flashEl, fadeTransition); |