From f3f1e781272ebf29681f804880bdd7e4fc34d5da Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Fri, 19 Jul 2019 00:35:49 +0200 Subject: Make flash notifications sticky This commit also unifies layout structure and remove no_container flag --- app/assets/javascripts/flash.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'app/assets/javascripts/flash.js') 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 => ` `; -const createFlashEl = (message, type, isFixedLayout = false) => ` -
-
+const createFlashEl = (message, type) => ` +
+
${_.escape(message)} + ${spriteIcon('close', 'close-icon')}
`; @@ -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); -- cgit v1.2.1