1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2025-02-21 05:21:47 -05:00

36 lines
939 B
JavaScript
Raw Normal View History

2013-08-29 20:38:28 -07:00
/*global $, app, me*/
"use strict";
var HumanView = require('human-view');
2013-08-29 20:38:28 -07:00
var templates = require('../templates');
var ContactListItem = require('../views/contactListItem');
module.exports = HumanView.extend({
2013-08-29 20:38:28 -07:00
template: templates.body,
2013-09-03 15:25:14 -07:00
events: {
'click a[href]': 'handleLinkClick'
},
classBindings: {
connected: '#connectionOverlay'
},
2013-08-29 20:38:28 -07:00
render: function () {
$('head').append(templates.head());
this.renderAndBind();
this.renderCollection(me.contacts, ContactListItem, this.$('#contactList'));
return this;
2013-09-03 15:25:14 -07:00
},
handleLinkClick: function (e) {
var t = $(e.target);
var aEl = t.is('a') ? t[0] : t.closest('a')[0];
var local = window.location.host === aEl.host;
var path = aEl.pathname.slice(1);
if (local) {
e.preventDefault();
app.navigate(path);
return false;
}
2013-08-29 20:38:28 -07:00
}
});