mirror of
https://github.com/moparisthebest/kaiwa
synced 2025-02-16 15:10:11 -05:00
adding video button that's enabled/disabled based on availability. Also waiting for roster load before starting router to make it so you can refresh the page and maintain your url
This commit is contained in:
parent
a864a8b19c
commit
2cec815821
@ -66,6 +66,12 @@ module.exports = {
|
||||
self.api.connect();
|
||||
},
|
||||
function (cb) {
|
||||
function start() {
|
||||
// start our router and show the appropriate page
|
||||
app.history.start({pushState: true, root: '/'});
|
||||
cb();
|
||||
}
|
||||
|
||||
new Router();
|
||||
app.history = Backbone.history;
|
||||
|
||||
@ -75,9 +81,11 @@ module.exports = {
|
||||
});
|
||||
self.view.render();
|
||||
|
||||
// we have what we need, we can now start our router and show the appropriate page
|
||||
app.history.start({pushState: true, root: '/'});
|
||||
cb();
|
||||
if (me.contacts.length) {
|
||||
start();
|
||||
} else {
|
||||
me.contacts.once('loaded', start);
|
||||
}
|
||||
}
|
||||
]);
|
||||
},
|
||||
|
@ -97,6 +97,8 @@ module.exports = HumanModel.define({
|
||||
contact.save();
|
||||
self.contacts.add(contact);
|
||||
});
|
||||
|
||||
self.contacts.trigger('loaded');
|
||||
});
|
||||
},
|
||||
isMe: function (jid) {
|
||||
|
@ -26,7 +26,8 @@ module.exports = BasePage.extend(chatHelpers).extend({
|
||||
},
|
||||
events: {
|
||||
'keydown textarea': 'handleKeyDown',
|
||||
'keyup textarea': 'handleKeyUp'
|
||||
'keyup textarea': 'handleKeyUp',
|
||||
'click .call': 'handleCallClick'
|
||||
},
|
||||
srcBindings: {
|
||||
avatar: 'header .avatar'
|
||||
@ -62,6 +63,7 @@ module.exports = BasePage.extend(chatHelpers).extend({
|
||||
this.$scrollContainer = this.$messageList;
|
||||
|
||||
this.listenTo(this.model.messages, 'add', this.handleChatAdded);
|
||||
this.listenToAndRun(this.model, 'change:jingleResources', this.handleJingleResourcesChanged);
|
||||
|
||||
this.renderCollection();
|
||||
|
||||
@ -78,6 +80,10 @@ module.exports = BasePage.extend(chatHelpers).extend({
|
||||
handlePageUnloaded: function () {
|
||||
this.scrollPageUnload();
|
||||
},
|
||||
handleCallClick: function () {
|
||||
this.model.call();
|
||||
return false;
|
||||
},
|
||||
renderCollection: function () {
|
||||
var self = this;
|
||||
var previous;
|
||||
@ -181,6 +187,10 @@ module.exports = BasePage.extend(chatHelpers).extend({
|
||||
var existing = this.$('#chat' + model.cid);
|
||||
existing.replaceWith(model.partialTemplateHtml);
|
||||
},
|
||||
handleJingleResourcesChanged: function (model, val) {
|
||||
var resources = val || this.model.jingleResources;
|
||||
this.$('button.call').prop('disabled', !resources.length);
|
||||
},
|
||||
appendModel: function (model, preload) {
|
||||
var self = this;
|
||||
var isGrouped = model.shouldGroupWith(this.lastModel);
|
||||
|
@ -160,7 +160,7 @@ exports.misc.growlMessage = function anonymous(locals) {
|
||||
exports.pages.chat = function anonymous(locals) {
|
||||
var buf = [];
|
||||
with (locals || {}) {
|
||||
buf.push('<section class="page chat"><section class="conversation"><header><img class="avatar"/><h1 class="name"></h1><div class="tzo"></div></header><ul class="messages scroll-container"></ul><div class="chatBox"><form><textarea name="chatInput" type="text" placeholder="Send a message..." autocomplete="off"></textarea></form></div></section></section>');
|
||||
buf.push('<section class="page chat"><section class="conversation"><header><img class="avatar"/><h1 class="name"></h1><div class="tzo"></div><button class="call">call</button></header><ul class="messages scroll-container"></ul><div class="chatBox"><form><textarea name="chatInput" type="text" placeholder="Send a message..." autocomplete="off"></textarea></form></div></section></section>');
|
||||
}
|
||||
return buf.join("");
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ section.page.chat
|
||||
img.avatar
|
||||
h1.name
|
||||
.tzo
|
||||
button.call call
|
||||
ul.messages.scroll-container
|
||||
.chatBox
|
||||
form
|
||||
|
@ -13,13 +13,13 @@
|
||||
"express": "3.3.7",
|
||||
"getconfig": "0.0.5",
|
||||
"jade": "0.35.0",
|
||||
"moonboots": "0.4.1",
|
||||
"moonboots": "0.7.0",
|
||||
"helmet": "0.1.0",
|
||||
"node-uuid": "1.4.1",
|
||||
"semi-static": "0.0.4",
|
||||
"sound-effect-manager": "0.0.5",
|
||||
"human-model": "1.4.0",
|
||||
"human-view": "1.1.2",
|
||||
"human-view": "1.2.0",
|
||||
"templatizer": "0.1.2",
|
||||
"underscore": "1.5.1",
|
||||
"raf-component": "1.1.1",
|
||||
|
@ -1,5 +1,5 @@
|
||||
CACHE MANIFEST
|
||||
# 0.0.1 1381784954237
|
||||
# 0.0.1 1381790561081
|
||||
|
||||
CACHE:
|
||||
/app.js
|
||||
|
Loading…
Reference in New Issue
Block a user