-
Notifications
You must be signed in to change notification settings - Fork 4
Replace Noty with Bootstrap Toasts (CFM-110) #12
Merged
+113
−3,331
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,13 +11,26 @@ | |
| <div class="<?= h($class) ?>" onclick="this.classList.add('hidden');"><?= $message ?></div> | ||
| */ ?> | ||
|
|
||
| <?php | ||
| if(!empty($message)) { | ||
| // Strip tags then escape quotes before handing Flash message to noty.js | ||
| $filteredMessage = filter_var(filter_var($message,FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES),FILTER_SANITIZE_ADD_SLASHES); | ||
| // Replace all newlines with html breaks | ||
| $filteredMessage = str_replace(array("\r", "\n"), '<br/>', $filteredMessage); | ||
| print "<script>generateFlash('" . $filteredMessage . "', '" . $class . "');</script>"; | ||
| } | ||
| ?> | ||
|
|
||
| <?php if(!empty($message)): ?> | ||
| <div class="toast error" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false"> | ||
| <div class="toast-header"> | ||
| <?= $this->Html->image("COmanage-Gears-SM.png", array('alt' => __('registry.meta.logo'))); ?> | ||
| <span class="me-auto"><?= __('registry.meta.comanage'); ?></span> | ||
| <small><?= __d('information','flash.default'); ?></small> | ||
| <button type="button" class="btn-close nospin" data-bs-dismiss="toast" aria-label="Close"></button> | ||
| </div> | ||
| <div class="toast-body"> | ||
| <?= $message ?> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just confirming we don't need to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cake claims that flash messages are escaped by default and safe for printing, but they also wrap all their examples in h() (htmlspecialchars) - so I've added that to the flash messages as well. |
||
| </div> | ||
| </div> | ||
|
|
||
| <script> | ||
| var toastElList = [].slice.call(document.querySelectorAll('.toast')) | ||
| var toastList = toastElList.map(function(toastEl) { | ||
| return new bootstrap.Toast(toastEl); | ||
| }); | ||
| toastList.forEach(toast => toast.show()); | ||
| </script> | ||
| <?php endif; ?> | ||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be
product.comanage?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Changed.