Commit 063b6602dc8e49a0e2e05826dd1e2c0a5c09b92e
- Diff rendering mode:
- inline
- side by side
mouchak/static/js/editor.js
(19 / 9)
  | |||
162 | 162 | }, | |
163 | 163 | listContent: function() { | |
164 | 164 | var content = ''; | |
165 | var base_props = _.keys(new M.types.model.base().defaults); | ||
165 | 166 | _.each(this.model.get('content'), function(element, idx) { | |
167 | //prepare the more field | ||
168 | var moar = ''; | ||
169 | _.each(element, function(v, k) { | ||
170 | //check if not one of the base properties..add it to more.. | ||
171 | if(_.indexOf(base_props, k) < 0) { | ||
172 | moar += (v) ? v + ', ' : ''; | ||
173 | } | ||
174 | }); | ||
166 | 175 | content += this.contentListTemplate({ | |
167 | 176 | no: idx, | |
168 | 177 | type: element.type, | |
169 | more: element.src || | ||
170 | escapeHtml(element.data.substring(0, 30) + '..'), | ||
178 | more: escapeHtml(moar.substring(0, 30) + '..'), | ||
171 | 179 | title: (element.title) ? element.title + ',' : '' | |
172 | 180 | }); | |
173 | 181 | }, this); | |
… | … | ||
394 | 394 | new_attrs[prop] = val; | |
395 | 395 | }); | |
396 | 396 | new_attrs['type'] = this.$select.val(); | |
397 | if(this.wysiwyg) { | ||
398 | var data = M.editor.wysiwyg.save('#edit'); | ||
399 | new_attrs['data'] = data; | ||
400 | } | ||
401 | else { | ||
402 | var data = M.editor.code.save('code-edit'); | ||
403 | new_attrs['data'] = data; | ||
397 | if(this.$select.val() === 'text') { | ||
398 | if(this.wysiwyg) { | ||
399 | var data = M.editor.wysiwyg.save('#edit'); | ||
400 | new_attrs['data'] = data; | ||
401 | } | ||
402 | else { | ||
403 | var data = M.editor.code.save('code-edit'); | ||
404 | new_attrs['data'] = data; | ||
405 | } | ||
404 | 406 | } | |
405 | 407 | this.model.set(new_attrs); | |
406 | 408 | M.editor.pageview.updateContent(this.model.toJSON()); |
mouchak/static/js/models.js
(4 / 2)
  | |||
4 | 4 | defaults: { | |
5 | 5 | tags: [], | |
6 | 6 | title: "", | |
7 | attr: {} | ||
7 | attr: {}, | ||
8 | type: '' | ||
8 | 9 | }, | |
9 | 10 | initialize: function() { | |
10 | 11 | } | |
… | … | ||
62 | 62 | // Map model | |
63 | 63 | var Map = BaseType.extend({ | |
64 | 64 | defaults: _.extend({ | |
65 | tileLayer:"", | ||
65 | tileLayer: "", | ||
66 | 66 | shp: "" | |
67 | 67 | }, BaseType.prototype.defaults), | |
68 | 68 | initialize: function(){ | |
… | … | ||
139 | 139 | //export types to the typemap | |
140 | 140 | M.types = M.types || {}; | |
141 | 141 | M.types.model = { | |
142 | 'base': BaseType, | ||
142 | 143 | 'text': Text, | |
143 | 144 | 'image': Image, | |
144 | 145 | 'video': Video, |