Commit 70daa0f2512a2839b79bff7bff40a5e49da232fb
- app.js 13 ---++++++++++
- Diff rendering mode:
- inline
- side by side
app.js
11 | 11 | ||
---|---|---|---|
12 | }; | 12 | }; |
13 | var How = Backbone.Model.extend({ | 13 | var How = Backbone.Model.extend({ |
14 | 14 | defaults: function() { | |
15 | return { | ||
15 | 'comment':'', | 16 | 'comment':'', |
16 | 'replyTo':'' | 17 | 'replyTo':'' |
18 | }; | ||
17 | }, | 19 | }, |
18 | initialize: function() { | 20 | initialize: function() { |
19 | } | 21 | } |
… | … | ||
128 | /* Create a sweet and send it to the sweet store. | 128 | /* Create a sweet and send it to the sweet store. |
129 | Update the view to include the comment */ | 129 | Update the view to include the comment */ |
130 | e.preventDefault(); | 130 | e.preventDefault(); |
131 | 131 | ||
132 | this.model.get('how').set({'comment':this.$("textarea.form-control").val()}); | ||
133 | console.log(this.model.get('how')); | ||
132 | this.model.set({created: new Date().toUTCString().substr(0, 25)}); | 134 | this.model.set({created: new Date().toUTCString().substr(0, 25)}); |
133 | new LoginView({model:this.model}); | 135 | new LoginView({model:this.model}); |
134 | 136 | ||
… | … | ||
182 | 182 | ||
183 | }, | 183 | }, |
184 | showOne: function(model) { | 184 | showOne: function(model) { |
185 | 185 | if(model.get('how').isNew === undefined) { | |
186 | console.log(model); | ||
187 | model.set({'how': new How(model.get('how'))}); | ||
188 | } | ||
186 | var view = new CommentView({model:model}); | 189 | var view = new CommentView({model:model}); |
187 | $(this.el).append(view.render().el); | 190 | $(this.el).append(view.render().el); |
188 | } | 191 | } |