|
@ -14,7 +14,7 @@ export default class FlashController extends Controller { |
|
|
static targets = ['flashItem'] |
|
|
static targets = ['flashItem'] |
|
|
|
|
|
|
|
|
connect() { |
|
|
connect() { |
|
|
if (FlashController.should_popup) { this.buildPopupFromWithin() } |
|
|
|
|
|
|
|
|
if (FlashController.should_popup) { this.buildPopupsFromWithin() } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
enable() { FlashController.should_popup = true } |
|
|
enable() { FlashController.should_popup = true } |
|
@ -27,7 +27,7 @@ export default class FlashController extends Controller { |
|
|
textNotice(message) { return `${this.iconNotice()}<div>${message}</div>` } |
|
|
textNotice(message) { return `${this.iconNotice()}<div>${message}</div>` } |
|
|
textAlert(message) { return `${this.iconAlert()}<div>${message}</div>` } |
|
|
textAlert(message) { return `${this.iconAlert()}<div>${message}</div>` } |
|
|
|
|
|
|
|
|
buildPopupFromWithin() { |
|
|
|
|
|
|
|
|
buildPopupsFromWithin() { |
|
|
FlashController.should_popup = false |
|
|
FlashController.should_popup = false |
|
|
this.flashItemTargets.forEach((item) => { |
|
|
this.flashItemTargets.forEach((item) => { |
|
|
this.onPopupEvent({ detail: { type: item.dataset.type, message: item.textContent.trim() } }) |
|
|
this.onPopupEvent({ detail: { type: item.dataset.type, message: item.textContent.trim() } }) |
|
|