Skip to content

Instantly share code, notes, and snippets.

@billsaysthis
Created March 30, 2012 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billsaysthis/2254144 to your computer and use it in GitHub Desktop.
Save billsaysthis/2254144 to your computer and use it in GitHub Desktop.
LayoutManager jQuery plugin question code sample
Public.Views.StarQuestionView = Backbone.View.extend({
template: 'public/common/questions/starQuestion_hb',
className: 'questionContainer'
});
Public.Form = Backbone.View.extend({
...
questionView: function(question, questionNumber) {
var qv;
...
} else if(question.displayType === 'star') {
qv = new Public.Views.StarQuestionView({ serialize: {questionName: question.name, questionNumber: questionNumber } });
}
return qv;
},
renderReviewForm: function(manage) {
var qv, view = manage(this), self = this, questionNumber = 0, questions = this.model.get('review').questions;
_.each(questions, function(question) {
view.insert('#ptQuestions', self.questionView(question, ++questionNumber));
});
qv = new Public.Views.SocialFansView({serialize: {general: this.model.get('general')}});
view.insert('.ptSidebar', qv);
return view.render().then(function(el) {
$(el).find('#ptRatingStar').raty({...options...});
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment