1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-08-13 17:03:51 -04:00

Add first pass at setting status messages

This commit is contained in:
Lance Stout 2013-09-20 14:54:34 -07:00
parent 96abc82f54
commit 79b72323bd
3 changed files with 25 additions and 9 deletions

View File

@ -13,11 +13,15 @@ module.exports = BasePage.extend({
srcBindings: { srcBindings: {
avatar: '#avatarChanger img' avatar: '#avatarChanger img'
}, },
textBindings: {
status: '.status'
},
events: { events: {
'click .enableAlerts': 'enableAlerts', 'click .enableAlerts': 'enableAlerts',
'dragover': 'handleAvatarChangeDragOver', 'dragover': 'handleAvatarChangeDragOver',
'drop': 'handleAvatarChange', 'drop': 'handleAvatarChange',
'change #uploader': 'handleAvatarChange' 'change #uploader': 'handleAvatarChange',
'blur .status': 'handleStatusChange'
}, },
initialize: function (spec) { initialize: function (spec) {
me.shouldAskForAlertsPermission = app.notifier.shouldAskPermission(); me.shouldAskForAlertsPermission = app.notifier.shouldAskPermission();
@ -74,5 +78,13 @@ module.exports = BasePage.extend({
}; };
fileTracker.readAsDataURL(file); fileTracker.readAsDataURL(file);
} }
},
handleStatusChange: function (e) {
var text = e.target.textContent;
me.status = text;
client.sendPresence({
status: text,
caps: client.disco.caps
});
} }
}); });

View File

@ -131,7 +131,7 @@ exports.pages.groupchat = function anonymous(locals) {
exports.pages.main = function anonymous(locals) { exports.pages.main = function anonymous(locals) {
var buf = []; var buf = [];
with (locals || {}) { with (locals || {}) {
buf.push('<section class="page main"><button class="enableAlerts">Enable alerts</button><div id="avatarChanger"><h1>Change Avatar</h1><div class="uploadRegion"><p>Drag and drop a new avatar here</p><img/><form><input id="uploader" type="file"/></form></div></div><h1>This space intentionally blank</h1></section>'); buf.push('<section class="page main"><p>Current status:<span contenteditable="true" class="status"></span></p><div id="avatarChanger"><h1>Change Avatar</h1><div class="uploadRegion"><p>Drag and drop a new avatar here</p><img/><form><input id="uploader" type="file"/></form></div></div><button class="enableAlerts">Enable alerts</button><h1>This space intentionally blank</h1></section>');
} }
return buf.join(""); return buf.join("");
}; };

View File

@ -1,12 +1,16 @@
section.page.main section.page.main
button.enableAlerts Enable alerts
p Current status:
span.status(contenteditable="true")
div#avatarChanger div#avatarChanger
h1 Change Avatar h1 Change Avatar
div.uploadRegion div.uploadRegion
p Drag and drop a new avatar here p Drag and drop a new avatar here
img img
form form
input#uploader(type="file") input#uploader(type="file")
button.enableAlerts Enable alerts
h1 This space intentionally blank h1 This space intentionally blank