Commit 18b27957b4e4ac89a53323576d86e71ec6da42c3
- Diff rendering mode:
- inline
- side by side
mouchak.conf
(2 / 2)
  | |||
1 | DB=test_mouchak | ||
2 | SITE_TITLE=Testing Mouchak | ||
1 | DB=crin | ||
2 | SITE_TITLE=Community Radio | India | ||
3 | 3 | HOST=0.0.0.0 | |
4 | 4 | PORT=5000 |
server.py
(1 / 1)
  | |||
107 | 107 | print changedMenu | |
108 | 108 | res = siteMenu.update({'_id': bson.ObjId(_id)}, changedMenu) | |
109 | 109 | print res | |
110 | return flask.jsonify(status='ok',menu=changedMenu) | ||
110 | return flask.jsonify(status='ok', menu=changedMenu) | ||
111 | 111 | ||
112 | 112 | #elif flask.request.method == 'DELETE': | |
113 | 113 | # delMenu = flask.request.url |
static/js/editor.js
(34 / 24)
  | |||
255 | 255 | $('#specific-content').html(template({ | |
256 | 256 | data: this.model.get('data') | |
257 | 257 | })); | |
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'); | ||
275 | 260 | } | |
276 | 261 | else if(type === 'image' || type === 'video' || type === 'audio') { | |
277 | 262 | var template = _.template($('#media-template').html()); | |
… | … | ||
333 | 333 | ||
334 | 334 | if(this.model.get('customMenu') === true) { | |
335 | 335 | $('#custom-menu').attr('checked', true); | |
336 | this.$menuOptions.show(); | ||
336 | this.$menuOptions.show({complete: function() { | ||
337 | M.editor.wysiwig('#menu'); | ||
338 | }}); | ||
337 | 339 | } | |
338 | 340 | }, | |
339 | 341 | showMenuOptions: function(bool) { | |
340 | 342 | if(bool === true) { | |
341 | this.$menuOptions.show(); | ||
343 | this.$menuOptions.show({complete: function() { | ||
344 | //M.editor.wysiwig('#menu'); | ||
345 | }}); | ||
342 | 346 | } | |
343 | 347 | else { | |
344 | 348 | this.$menuOptions.hide(); | |
… | … | ||
359 | 359 | this.showMenuOptions(this.model.get('customMenu')); | |
360 | 360 | }, | |
361 | 361 | 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({}, { | ||
366 | 368 | success: function(model, response) { | |
369 | console.log(model, response); | ||
367 | 370 | }, | |
368 | 371 | error: function(xhr, response) { | |
369 | 372 | } | |
370 | }); | ||
373 | });*/ | ||
374 | //alert('end of save menu'); | ||
371 | 375 | } | |
372 | 376 | }); | |
373 | 377 | ||
… | … | ||
384 | 384 | pagelistview.render(); | |
385 | 385 | }); | |
386 | 386 | 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 | }); | ||
387 | 404 | } | |
388 | 405 | }; | |
389 | 406 |
static/js/mouchak.js
(6 / 1)
  | |||
49 | 49 | console.log('rendering custom menu..'); | |
50 | 50 | this.$el.append(this.model.get('html')); | |
51 | 51 | } | |
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 | } | ||
52 | 58 | var fragment = location.hash.split('/')[1]; | |
53 | 59 | var pos = _.indexOf(M.pages.models, M.pages.where({'name': fragment})[0]); | |
54 | 60 | if(!fragment) { | |
… | … | ||
71 | 71 | page: page.get('name') | |
72 | 72 | })); | |
73 | 73 | }, this); | |
74 | this.$links = $('.nav li'); | ||
75 | 74 | }, | |
76 | 75 | navClicked: function(event) { | |
77 | 76 | this.$links.removeClass('active'); |
templates/editor.html
(2 / 2)
  | |||
70 | 70 | </div> | |
71 | 71 | </div> | |
72 | 72 | <label><strong> HTML </strong></label> | |
73 | <textarea id="menu"> | ||
73 | <div id="menu"> | ||
74 | 74 | <%= menu %> | |
75 | </textarea> | ||
75 | </div> | ||
76 | 76 | </div> | |
77 | 77 | </form> | |
78 | 78 | </div> |