Commit 66e3c71ebb4c3875c964dbc631e3486b10fa1ec1

Fix: adding to existing content was not saving

  When more content was added to exisiting content, it was not saving the new
content. This because of a one-line bug in editor.js. Fix that.
  
165165 showContent: function(event) {
166166 var idx = $(event.target).closest('.content-item').attr('id').
167167 split('-')[1];
168 this.edit = {on: true, idx: idx};
169168 var content = this.model.get('content')[idx];
170169 content = new M.types.model[content.type](content);
170 this.editing = true;
171171 var contentview = new ContentView({model: content});
172172 contentview.render();
173173 M.editor.contentview = contentview;
365365 this.$menuOrder = $('#menu-order-wrap');
366366
367367 if(this.model.get('customMenu') === true) {
368 this.$menuOrder.hide();
368369 $('#custom-menu').attr('checked', true);
369370 this.$menuOptions.show({complete: function() {
370371 //M.editor.wysiwig('#menu');
399399 var success_template = _.template($('#success-notif').html());
400400 var fail_template = _.template($('#fail-notif').html());
401401
402 var bool, html = '', menuOrder = [];
403 if($('#custom-menu').is(":checked")) {
404 bool = true;
405 html = $('#menu').val().trim();
402 if($('#custom-menu').is(':checked')) {
403 var html = $('#menu').val().trim() || '';
404 this.model.set({'customMenu': true, 'html': html});
406405 }
407406 else {
408 bool = false;
409 menuOrder = $('#menu-order').val().split(',');
407 var menuOrder = $('#menu-order').val().split(',') || [];
408 this.model.set({'customMenu': false, 'menuOrder': menuOrder});
410409 }
411 this.model.set({'customMenu': bool, 'html': html, 'menuOrder': menuOrder});
412 //console.log(this.model.toJSON());
410 //console.log('menu model: ', this.model.toJSON());
413411 this.model.save({}, {
414412 success: function(model, response) {
415413 //console.log(model, response);
  
5454 <div class="page">
5555 <div class="menu-config">
5656 <h4> Menu Config </h4>
57
58 <div class="control-group" id="menu-order-wrap">
59 <div class="input-prepend">
60 <span class="add-on"> <strong> Menu Order</strong></span>
61 <input id="menu-order" type="text" class="span4"
62 placeholder="list,page,names,for,menu,order" value="<%= menu_order %>">
63 </div>
64 </div>
65
5766 <div class="control-group">
5867 <input id="custom-menu" type="checkbox">
5968 <span class=""><strong> Custom Menu </strong></span>
6069 </div>
61 <div class="control-group" id="menu-order-wrap">
62 <% if(!$('#custom-menu').is(':checked')) { %>
63 <div class="input-prepend">
64 <span class="add-on"> <strong> Menu Order</strong></span>
65 <input id="menu-order" type="text" class="span4"
66 placeholder="list,page,names,for,menu,order" value="<%= menu_order %>">
67 </div>
68 <% } %>
69 </div>
70
7071 <div class="menu-options" style="display: none;">
7172 <div class="control-group">
7273 <div class="input-prepend">
7979 <label><strong> HTML for menu: </strong></label>
8080 <textarea cols="25" rows="8" id="menu"><%= menu %></textarea>
8181 </div>
82
8283 </div>
8384 <button id="updateMenu" class="btn btn-primary pull-right"> Update </button>
8485 <div class="clearfix"></div>