1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-28 12:12:26 -05:00
kaiwa/clientapp/pages/base.js

54 lines
1.0 KiB
JavaScript
Raw Normal View History

/*global $, app, me*/
2013-08-29 23:38:28 -04:00
"use strict";
var _ = require('underscore');
var HumanView = require('human-view');
2013-08-29 23:38:28 -04:00
module.exports = HumanView.extend({
2013-08-29 23:38:28 -04:00
show: function (animation) {
var self = this;
$('body').scrollTop(0);
if (this.detached) {
this.$('#pages').append(this.el);
this.detached = false;
} else {
this.render();
}
this.$el.addClass('active');
app.currentPage = this;
app.state.pageTitle = _.result(self, 'title');
2013-08-29 23:38:28 -04:00
this.trigger('pageloaded');
if (this.model.jid) {
me.setActiveContact(this.model.jid);
}
2013-08-29 23:38:28 -04:00
return this;
},
hide: function () {
var self = this;
this.$el.removeClass('active');
this.trigger('pageunloaded');
if (this.cache) {
this.$el.detach();
this.detached = true;
} else {
this.animateRemove();
}
me.setActiveContact('');
2013-08-29 23:38:28 -04:00
return this;
}
});