Files
dss/static/js/app/views/user/userItemView.js
Fergal Moran 4a49264d15 No message
2013-07-22 09:41:22 +01:00

55 lines
1.8 KiB
JavaScript
Executable File

// Generated by CoffeeScript 1.3.3
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['app', 'moment', 'marionette', 'vent', 'text!/tpl/UserListItemView'], function(App, moment, Marionette, vent, Template) {
var UserItemView;
UserItemView = (function(_super) {
__extends(UserItemView, _super);
function UserItemView() {
this.initialize = __bind(this.initialize, this);
return UserItemView.__super__.constructor.apply(this, arguments);
}
UserItemView.prototype.template = _.template(Template);
UserItemView.prototype.tagName = "div";
UserItemView.prototype.className = "row-fluid";
UserItemView.prototype.events = {
"click #follow-button": "followUser",
"click #follow-button-login": "promptLogin"
};
UserItemView.prototype.templateHelpers = {
humanise: function(date) {
return moment(date).fromNow();
}
};
UserItemView.prototype.initialize = function() {
return this.listenTo(this.model, 'change:following', this.render);
};
UserItemView.prototype.followUser = function() {
console.log("UserItemView: followUser");
return vent.trigger("user:follow", this.model);
};
UserItemView.prototype.promptLogin = function() {
return vent.trigger("app:login", this.model);
};
return UserItemView;
})(Marionette.ItemView);
return UserItemView;
});
}).call(this);