diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-05 12:27:43 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-10 12:14:23 +0300 |
commit | fcd842b55837d2a8eab4ef32b65b5a44dfab6eba (patch) | |
tree | 7a6fdd2c94130aab0800d189c881b2bec7ae148a /app/assets | |
parent | cbfc97b112849299b0aaf3b5155e278d3db17c91 (diff) |
fixed notes specs
changed how the container class is added onto the text element
more specs
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/flash.js | 14 | ||||
-rw-r--r-- | app/assets/javascripts/notes.js | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js index 8ac2b96a22d..bc5cd818e1c 100644 --- a/app/assets/javascripts/flash.js +++ b/app/assets/javascripts/flash.js @@ -12,6 +12,7 @@ const hideFlash = (flashEl, fadeTransition = true) => { flashEl.remove(); }, { once: true, + passive: true, }); if (!fadeTransition) flashEl.dispatchEvent(new Event('transitionend')); @@ -27,12 +28,12 @@ const createAction = config => ` </a> `; -const createFlashEl = (message, type) => ` +const createFlashEl = (message, type, isInContentWrapper = false) => ` <div class="flash-${type}" > <div - class="flash-text" + class="flash-text ${isInContentWrapper ? 'container-fluid container-limited' : ''}" > ${_.escape(message)} </div> @@ -64,7 +65,9 @@ const createFlash = function createFlash( if (!flashContainer) return null; - flashContainer.innerHTML = createFlashEl(message, type); + const isInContentWrapper = flashContainer.parentNode.classList.contains('content-wrapper'); + + flashContainer.innerHTML = createFlashEl(message, type, isInContentWrapper); const flashEl = flashContainer.querySelector(`.flash-${type}`); flashEl.addEventListener('click', () => hideFlash(flashEl, fadeTransition)); @@ -77,11 +80,6 @@ const createFlash = function createFlash( } } - if (flashContainer.parentNode.classList.contains('content-wrapper')) { - const flashText = flashEl.querySelector('.flash-text'); - flashText.className = `${flashText.className} container-fluid container-limited`; - } - flashContainer.style.display = 'block'; return flashContainer; diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index dafbfb59c99..cf7322ba1da 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -1213,13 +1213,13 @@ export default class Notes { } addFlash(...flashParams) { - this.flashInstance = new Flash(...flashParams); + this.flashContainer = new Flash(...flashParams); } clearFlash() { - if (this.flashInstance && this.flashInstance.flashContainer) { - this.flashInstance.flashContainer.hide(); - this.flashInstance = null; + if (this.flashContainer) { + this.flashContainer.style.display = 'none'; + this.flashContainer = null; } } |