Commit 18b27957b4e4ac89a53323576d86e71ec6da42c3

Small fixes. Still custom menu doesn't work.

  - small fixes in the UI code.
  - lot of logging to debug custom menu
  
1DB=test_mouchak
2SITE_TITLE=Testing Mouchak
1DB=crin
2SITE_TITLE=Community Radio | India
33HOST=0.0.0.0
44PORT=5000
server.py
(1 / 1)
  
107107 print changedMenu
108108 res = siteMenu.update({'_id': bson.ObjId(_id)}, changedMenu)
109109 print res
110 return flask.jsonify(status='ok',menu=changedMenu)
110 return flask.jsonify(status='ok', menu=changedMenu)
111111
112112 #elif flask.request.method == 'DELETE':
113113 # delMenu = flask.request.url
  
255255 $('#specific-content').html(template({
256256 data: this.model.get('data')
257257 }));
258 // init the tinymce editor
259 tinymce.init({
260 selector: '#edit',
261 theme: 'modern',
262 height: 300,
263 plugins: ["advlist autolink link image lists charmap print preview hr",
264 "anchor pagebreak spellchecker searchreplace wordcount",
265 "visualblocks visualchars code fullscreen insertdatetime",
266 "media nonbreaking save table contextmenu directionality",
267 "emoticons template paste textcolor"
268 ],
269 toolbar: "undo redo | styleselect | bold italic | " +
270 "alignleft aligncenter alignright alignjustify | " +
271 "bullist numlist outdent indent | link image | " +
272 "print preview media fullpage | forecolor backcolor emoticons"
273
274 });
258 // init the wysiwig editor
259 M.editor.wysiwig('#edit');
275260 }
276261 else if(type === 'image' || type === 'video' || type === 'audio') {
277262 var template = _.template($('#media-template').html());
333333
334334 if(this.model.get('customMenu') === true) {
335335 $('#custom-menu').attr('checked', true);
336 this.$menuOptions.show();
336 this.$menuOptions.show({complete: function() {
337 M.editor.wysiwig('#menu');
338 }});
337339 }
338340 },
339341 showMenuOptions: function(bool) {
340342 if(bool === true) {
341 this.$menuOptions.show();
343 this.$menuOptions.show({complete: function() {
344 //M.editor.wysiwig('#menu');
345 }});
342346 }
343347 else {
344348 this.$menuOptions.hide();
359359 this.showMenuOptions(this.model.get('customMenu'));
360360 },
361361 saveMenu: function() {
362 var menuHTML = $('#menu').val().trim();
363 this.model.set({'html': menuHTML});
364 console.log(this.model.toJSON());
365 this.model.save({}, {
362 //console.log('saving menu..');
363 // var menuHTML = $('#menu').val().trim();
364 //this.model.set({'html': menuHTML});
365 //console.log(this.model.toJSON());
366 //alert('saveMenu called');
367 /*this.model.save({}, {
366368 success: function(model, response) {
369 console.log(model, response);
367370 },
368371 error: function(xhr, response) {
369372 }
370 });
373 });*/
374 //alert('end of save menu');
371375 }
372376 });
373377
384384 pagelistview.render();
385385 });
386386 M.pagelistview = pagelistview;
387 },
388 wysiwig: function($selector) {
389 tinymce.init({
390 selector: $selector,
391 theme: 'modern',
392 height: 300,
393 plugins: ["advlist autolink link image lists charmap print preview hr",
394 "anchor pagebreak spellchecker searchreplace wordcount",
395 "visualblocks visualchars code fullscreen insertdatetime",
396 "media nonbreaking save table contextmenu directionality",
397 "emoticons template paste textcolor"
398 ],
399 toolbar: "undo redo | styleselect | bold italic | " +
400 "alignleft aligncenter alignright alignjustify | " +
401 "bullist numlist outdent indent | link image | " +
402 "print preview media fullpage | forecolor backcolor emoticons"
403 });
387404 }
388405 };
389406
  
4949 console.log('rendering custom menu..');
5050 this.$el.append(this.model.get('html'));
5151 }
52 this.$links = $('.nav li');
53 if(!this.$links) {
54 throw new Error('Ill-formed menu! Please check you have <ul> element' +
55 'inside your menu with class nav and <li> elements inside it');
56 alert('Error in Menu: Please check console for details');
57 }
5258 var fragment = location.hash.split('/')[1];
5359 var pos = _.indexOf(M.pages.models, M.pages.where({'name': fragment})[0]);
5460 if(!fragment) {
7171 page: page.get('name')
7272 }));
7373 }, this);
74 this.$links = $('.nav li');
7574 },
7675 navClicked: function(event) {
7776 this.$links.removeClass('active');
  
7070 </div>
7171 </div>
7272 <label><strong> HTML </strong></label>
73 <textarea id="menu">
73 <div id="menu">
7474 <%= menu %>
75 </textarea>
75 </div>
7676 </div>
7777 </form>
7878 </div>