Commit 70daa0f2512a2839b79bff7bff40a5e49da232fb

  • avatar
  • arvind
  • Wed Mar 05 21:13:18 IST 2014
Code refactor.
app.js
(10 / 3)
  
1111
1212 };
1313 var How = Backbone.Model.extend({
14 defaults: {
14 defaults: function() {
15 return {
1516 'comment':'',
1617 'replyTo':''
18 };
1719 },
1820 initialize: function() {
1921 }
128128 /* Create a sweet and send it to the sweet store.
129129 Update the view to include the comment */
130130 e.preventDefault();
131 this.model.set({'how': new How({'comment':this.$("textarea.form-control").val()})});
131
132 this.model.get('how').set({'comment':this.$("textarea.form-control").val()});
133 console.log(this.model.get('how'));
132134 this.model.set({created: new Date().toUTCString().substr(0, 25)});
133135 new LoginView({model:this.model});
134136
182182
183183 },
184184 showOne: function(model) {
185 model.set({'how': new How(model.get('how'))});
185 if(model.get('how').isNew === undefined) {
186 console.log(model);
187 model.set({'how': new How(model.get('how'))});
188 }
186189 var view = new CommentView({model:model});
187190 $(this.el).append(view.render().el);
188191 }