diaspora/public/javascripts/app/views/post-viewer/interactions.js
Dennis Collinson b28508ecbc MS DC show last post and show page works unauthenticated
phasing out app.user() for app.currentUser
2012-02-24 19:09:00 -08:00

46 lines
1.3 KiB
JavaScript

app.views.PostViewerInteractions = app.views.Base.extend({
className : "",
subviews : {
"#post-feedback" : "feedbackView",
"#post-reactions" : "reactionsView",
"#new-post-comment" : "newCommentView"
},
templateName: "post-viewer/interactions",
initialize : function() {
this.initViews();
this.feedbackView && this.feedbackView.bind("invokePane", this.invokePane, this)
this.feedbackView && this.feedbackView.bind("hidePane", this.hidePane, this)
},
initViews : function() {
this.reactionsView = new app.views.PostViewerReactions({ model : this.model })
/* subviews that require user */
if(app.currentUser.authenticated()) {
this.feedbackView = new app.views.PostViewerFeedback({ model : this.model })
this.newCommentView = new app.views.PostViewerNewComment({ model : this.model })
}
},
togglePane : function(evt) {
if(evt) { evt.preventDefault() }
this.$("#post-info").slideToggle(300)
this.$("#post-info-sneaky").toggleClass('passive')
this.removeTooltips()
},
invokePane : function(evt) {
if(evt) { evt.preventDefault() }
if(!this.$("#post-info").is(":visible")) { this.togglePane() }
},
hidePane : function(evt) {
if(evt) { evt.preventDefault() }
if(this.$("#post-info").is(":visible")) { this.togglePane() }
}
})