Commit 4caaa595b4adf4b39a1157139711635c42acb223
- Diff rendering mode:
- inline
- side by side
mouchak/static/js/editor.js
(11 / 1)
  | |||
109 | 109 | _.bindAll(this); | |
110 | 110 | _.bind(this.render, this); | |
111 | 111 | this.editing = false; | |
112 | this.edit_idx = -1; | ||
112 | 113 | $('#page').remove(); | |
113 | 114 | $('#content-container').append(this.$el); | |
114 | 115 | this.template = _.template($('#page-template').html()); | |
… | … | ||
169 | 169 | var content = this.model.get('content')[idx]; | |
170 | 170 | content = new M.types.model[content.type](content); | |
171 | 171 | this.editing = true; | |
172 | this.edit_idx = idx; | ||
172 | 173 | var contentview = new ContentView({model: content}); | |
173 | 174 | contentview.render(); | |
174 | 175 | M.editor.contentview = contentview; | |
… | … | ||
183 | 183 | data: '' | |
184 | 184 | }); | |
185 | 185 | this.editing = true; | |
186 | this.edit_idx = -1; | ||
186 | 187 | var contentview = new ContentView({model: content}); | |
187 | 188 | contentview.render(); | |
188 | 189 | M.editor.contentview = contentview; | |
… | … | ||
195 | 195 | } | |
196 | 196 | //console.log('updateContent in Pageview'); | |
197 | 197 | var content = this.model.get('content'); | |
198 | content.push(json); | ||
198 | if(this.edit_idx > -1) { | ||
199 | content[this.edit_idx] = json; | ||
200 | } | ||
201 | else { | ||
202 | content.push(json); | ||
203 | } | ||
204 | |||
199 | 205 | this.editing = false; | |
206 | this.edit_idx = -1; | ||
200 | 207 | //console.log('setting content in page: ', content); | |
201 | 208 | this.model.set({'content': content}); | |
202 | 209 | this.render(); |