diff options
Diffstat (limited to 'ext/mixed/js/display-generator.js')
-rw-r--r-- | ext/mixed/js/display-generator.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js index d7cc5bd4..70cbcf13 100644 --- a/ext/mixed/js/display-generator.js +++ b/ext/mixed/js/display-generator.js @@ -192,6 +192,23 @@ class DisplayGenerator { return node; } + createAnkiNoteErrorsNotificationContent(errors) { + const content = this._templates.instantiate('footer-notification-anki-errors-content'); + + const header = content.querySelector('.anki-note-error-header'); + header.textContent = (errors.length === 1 ? 'An error occurred:' : `${errors.length} errors occurred:`); + + const list = content.querySelector('.anki-note-error-list'); + for (const error of errors) { + const div = document.createElement('li'); + div.className = 'anki-note-error-message'; + div.textContent = isObject(error) && typeof error.message === 'string' ? error.message : `${error}`; + list.appendChild(div); + } + + return content; + } + createProfileListItem() { return this._templates.instantiate('profile-list-item'); } |