diff --git a/client/css/main.css b/client/css/main.css index c161a6a4..e4f27ab2 100644 --- a/client/css/main.css +++ b/client/css/main.css @@ -112,6 +112,7 @@ nav.text-nav ul li.active a { .messages { width: 30em; + max-width: 100%; } .messages .message { display: inline-block; diff --git a/client/js/api.js b/client/js/api.js index b950b688..0bb6c800 100644 --- a/client/js/api.js +++ b/client/js/api.js @@ -31,7 +31,9 @@ class Api { req.set('Accept', 'application/json') .end((error, response) => { if (error) { - reject(response.body); + reject(response && response.body ? response.body : { + 'title': 'Networking error', + 'description': error.message}); } else { resolve(response.body); } diff --git a/client/js/views/base_view.js b/client/js/views/base_view.js index 1a0f7d0c..0f4aaf8b 100644 --- a/client/js/views/base_view.js +++ b/client/js/views/base_view.js @@ -32,7 +32,7 @@ class BaseView { const messagesHolder = this.contentHolder.querySelector('.messages'); /* TODO: animate this */ const node = document.createElement('div'); - node.innerHTML = message; + node.innerHTML = message.replace(/\n/g, '
'); node.classList.add('message'); node.classList.add(className); messagesHolder.appendChild(node);