client/views: show "!" in document title on errors

Closes #96
This commit is contained in:
rr- 2016-09-26 22:44:32 +02:00
parent 560a7d6839
commit d31acc5952
2 changed files with 7 additions and 0 deletions

View file

@ -53,6 +53,7 @@ class TopNavigation extends events.EventTarget {
}
setTitle(title) {
document.oldTitle = null;
document.title = config.name + (title ? (' ' + title) : '');
}

View file

@ -288,6 +288,8 @@ function showMessage(target, message, className) {
}
function showError(target, message) {
document.oldTitle = document.title;
document.title = `! ${document.title}`;
return showMessage(target, misc.formatInlineMarkdown(message), 'error');
}
@ -300,6 +302,10 @@ function showInfo(target, message) {
}
function clearMessages(target) {
if (document.oldTitle) {
document.title = document.oldTitle;
document.oldTitle = null;
}
const messagesHolder = target.querySelector('.messages');
/* TODO: animate that */
emptyContent(messagesHolder);