Commit 063b6602dc8e49a0e2e05826dd1e2c0a5c09b92e

Fix map plugin save throwing error

  Map plugin was throwing error while saving, this was because it was assumed
that all types would have atleast an attribute called data. Fix that.
  
162162 },
163163 listContent: function() {
164164 var content = '';
165 var base_props = _.keys(new M.types.model.base().defaults);
165166 _.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 });
166175 content += this.contentListTemplate({
167176 no: idx,
168177 type: element.type,
169 more: element.src ||
170 escapeHtml(element.data.substring(0, 30) + '..'),
178 more: escapeHtml(moar.substring(0, 30) + '..'),
171179 title: (element.title) ? element.title + ',' : ''
172180 });
173181 }, this);
394394 new_attrs[prop] = val;
395395 });
396396 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 }
404406 }
405407 this.model.set(new_attrs);
406408 M.editor.pageview.updateContent(this.model.toJSON());
  
44 defaults: {
55 tags: [],
66 title: "",
7 attr: {}
7 attr: {},
8 type: ''
89 },
910 initialize: function() {
1011 }
6262 // Map model
6363 var Map = BaseType.extend({
6464 defaults: _.extend({
65 tileLayer:"",
65 tileLayer: "",
6666 shp: ""
6767 }, BaseType.prototype.defaults),
6868 initialize: function(){
139139 //export types to the typemap
140140 M.types = M.types || {};
141141 M.types.model = {
142 'base': BaseType,
142143 'text': Text,
143144 'image': Image,
144145 'video': Video,