1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-22 09:12:19 -05: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: {
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
});
}
});

View File

@ -131,7 +131,7 @@ exports.pages.groupchat = function anonymous(locals) {
exports.pages.main = function anonymous(locals) {
var buf = [];
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("");
};

View File

@ -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