Commit 541dcd12e382d0f95c15c04d6f1f31bf1a1e5e4a
- Diff rendering mode:
- inline
- side by side
mouchak/static/js/editor.js
(33 / 2)
  | |||
9 | 9 | 'click .pagename .disp': 'showPage', | |
10 | 10 | 'click #addPage': 'addPage', | |
11 | 11 | 'click .pagename .remove': 'removePage', | |
12 | 'click #menu-config': 'showMenu' | ||
12 | 'click #menu-config': 'showMenu', | ||
13 | 'click #footer-config': 'footerConfig' | ||
13 | 14 | }, | |
14 | 15 | initialize: function() { | |
15 | 16 | _.bindAll(this); | |
… | … | ||
25 | 25 | //console.log(menu); | |
26 | 26 | this.menuconfig = new M.types.model.menu(menu); | |
27 | 27 | this.menuconfigview = new MenuConfigView({model: this.menuconfig}); | |
28 | this.footerconfigview = new FooterConfigView(); | ||
28 | 29 | }, | |
29 | 30 | render: function() { | |
30 | 31 | // append the page list | |
… | … | ||
69 | 69 | }, | |
70 | 70 | showMenu: function(event) { | |
71 | 71 | this.menuconfigview.render(); | |
72 | }, | ||
73 | footerConfig: function(event) { | ||
74 | this.footerconfigview.render(); | ||
72 | 75 | } | |
73 | 76 | }); | |
74 | 77 | ||
… | … | ||
263 | 263 | // init the wysiwig editor | |
264 | 264 | M.editor.wysiwig('#edit'); | |
265 | 265 | } | |
266 | else if(type === 'image' || type === 'video' || type === 'audio') { | ||
266 | else if(type === 'image' || type === 'video' || | ||
267 | type === 'audio' || type === 'plugin') { | ||
267 | 268 | var template = _.template($('#media-template').html()); | |
269 | |||
268 | 270 | $('#specific-content').html(template({ | |
269 | 271 | src: this.model.get('src') | |
270 | 272 | })); | |
… | … | ||
313 | 313 | done: function() { | |
314 | 314 | this.update(); | |
315 | 315 | this.cleanUp(); | |
316 | } | ||
317 | }); | ||
318 | |||
319 | /* view to configure footer */ | ||
320 | var FooterConfigView = Backbone.View.extend({ | ||
321 | tagName: 'div', | ||
322 | id: 'page', | ||
323 | events: { | ||
324 | 'click #saveFooter': 'saveFooter' | ||
325 | }, | ||
326 | initialize: function() { | ||
327 | _.bindAll(this); | ||
328 | this.template = _.template($('#footer-config-template').html()); | ||
329 | }, | ||
330 | render: function() { | ||
331 | $('#page').remove(); | ||
332 | $('#content-container').append(this.$el); | ||
333 | this.$el.html(this.template()); | ||
334 | M.editor.wysiwig('#footer-input'); | ||
335 | }, | ||
336 | saveFooter: function() { | ||
337 | tinymce.triggerSave(false, true); | ||
338 | var data = $('#footer-input').html(); | ||
339 | console.log(data); | ||
316 | 340 | } | |
317 | 341 | }); | |
318 | 342 |