Commit 70daa0f2512a2839b79bff7bff40a5e49da232fb
- Diff rendering mode:
- inline
- side by side
app.js
(10 / 3)
  | |||
11 | 11 | ||
12 | 12 | }; | |
13 | 13 | var How = Backbone.Model.extend({ | |
14 | defaults: { | ||
14 | defaults: function() { | ||
15 | return { | ||
15 | 16 | 'comment':'', | |
16 | 17 | 'replyTo':'' | |
18 | }; | ||
17 | 19 | }, | |
18 | 20 | initialize: function() { | |
19 | 21 | } | |
… | … | ||
128 | 128 | /* Create a sweet and send it to the sweet store. | |
129 | 129 | Update the view to include the comment */ | |
130 | 130 | 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')); | ||
132 | 134 | this.model.set({created: new Date().toUTCString().substr(0, 25)}); | |
133 | 135 | new LoginView({model:this.model}); | |
134 | 136 | ||
… | … | ||
182 | 182 | ||
183 | 183 | }, | |
184 | 184 | 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 | } | ||
186 | 189 | var view = new CommentView({model:model}); | |
187 | 190 | $(this.el).append(view.render().el); | |
188 | 191 | } |