diff --git a/clientapp/pages/main.js b/clientapp/pages/main.js index da3a60f..03d931f 100644 --- a/clientapp/pages/main.js +++ b/clientapp/pages/main.js @@ -13,11 +13,15 @@ module.exports = BasePage.extend({ srcBindings: { avatar: '#avatarChanger img' }, + textBindings: { + status: '.status' + }, events: { 'click .enableAlerts': 'enableAlerts', 'dragover': 'handleAvatarChangeDragOver', 'drop': 'handleAvatarChange', - 'change #uploader': 'handleAvatarChange' + 'change #uploader': 'handleAvatarChange', + 'blur .status': 'handleStatusChange' }, initialize: function (spec) { me.shouldAskForAlertsPermission = app.notifier.shouldAskPermission(); @@ -74,5 +78,13 @@ module.exports = BasePage.extend({ }; fileTracker.readAsDataURL(file); } + }, + handleStatusChange: function (e) { + var text = e.target.textContent; + me.status = text; + client.sendPresence({ + status: text, + caps: client.disco.caps + }); } }); diff --git a/clientapp/templates.js b/clientapp/templates.js index 38b8e5b..daf4c4a 100644 --- a/clientapp/templates.js +++ b/clientapp/templates.js @@ -131,7 +131,7 @@ exports.pages.groupchat = function anonymous(locals) { exports.pages.main = function anonymous(locals) { var buf = []; with (locals || {}) { - buf.push('

Change Avatar

Drag and drop a new avatar here

This space intentionally blank

'); + buf.push('

Current status:

Change Avatar

Drag and drop a new avatar here

This space intentionally blank

'); } return buf.join(""); }; diff --git a/clientapp/templates/pages/main.jade b/clientapp/templates/pages/main.jade index d6dd4c8..d2059cf 100644 --- a/clientapp/templates/pages/main.jade +++ b/clientapp/templates/pages/main.jade @@ -1,12 +1,16 @@ section.page.main - button.enableAlerts Enable alerts + + p Current status: + span.status(contenteditable="true") div#avatarChanger - h1 Change Avatar - div.uploadRegion - p Drag and drop a new avatar here - img - form - input#uploader(type="file") + h1 Change Avatar + div.uploadRegion + p Drag and drop a new avatar here + img + form + input#uploader(type="file") + + button.enableAlerts Enable alerts h1 This space intentionally blank