mirror of
https://github.com/fergalmoran/dss.git
synced 2026-04-05 04:15:01 +00:00
27 lines
782 B
CoffeeScript
Executable File
27 lines
782 B
CoffeeScript
Executable File
define ['app', 'moment', 'marionette', 'vent', 'text!/tpl/UserListItemView'],
|
|
(App, moment, Marionette, vent, Template)->
|
|
class UserItemView extends Marionette.ItemView
|
|
template: _.template(Template)
|
|
tagName: "div"
|
|
className: "row-fluid"
|
|
|
|
events:
|
|
"click #follow-button": "followUser"
|
|
"click #follow-button-login": "promptLogin"
|
|
|
|
templateHelpers:
|
|
humanise: (date)->
|
|
moment(date).fromNow()
|
|
|
|
initialize: =>
|
|
@listenTo(@model, 'change:is_following', @render)
|
|
|
|
followUser: ->
|
|
console.log("UserItemView: followUser")
|
|
vent.trigger("user:follow", @model)
|
|
|
|
promptLogin:->
|
|
vent.trigger("app:login", @model)
|
|
|
|
UserItemView
|