From 541dcd12e382d0f95c15c04d6f1f31bf1a1e5e4a Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Tue, 20 Aug 2013 21:58:31 +0530 Subject: [PATCH] Add Plugin type in the editor --- mouchak/static/js/editor.js | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/mouchak/static/js/editor.js b/mouchak/static/js/editor.js index e54e67a..a7d249b 100644 --- a/mouchak/static/js/editor.js +++ b/mouchak/static/js/editor.js @@ -9,7 +9,8 @@ 'click .pagename .disp': 'showPage', 'click #addPage': 'addPage', 'click .pagename .remove': 'removePage', - 'click #menu-config': 'showMenu' + 'click #menu-config': 'showMenu', + 'click #footer-config': 'footerConfig' }, initialize: function() { _.bindAll(this); @@ -24,6 +25,7 @@ //console.log(menu); this.menuconfig = new M.types.model.menu(menu); this.menuconfigview = new MenuConfigView({model: this.menuconfig}); + this.footerconfigview = new FooterConfigView(); }, render: function() { // append the page list @@ -67,6 +69,9 @@ }, showMenu: function(event) { this.menuconfigview.render(); + }, + footerConfig: function(event) { + this.footerconfigview.render(); } }); @@ -258,8 +263,10 @@ // init the wysiwig editor M.editor.wysiwig('#edit'); } - else if(type === 'image' || type === 'video' || type === 'audio') { + else if(type === 'image' || type === 'video' || + type === 'audio' || type === 'plugin') { var template = _.template($('#media-template').html()); + $('#specific-content').html(template({ src: this.model.get('src') })); @@ -309,6 +316,30 @@ } }); + /* view to configure footer */ + var FooterConfigView = Backbone.View.extend({ + tagName: 'div', + id: 'page', + events: { + 'click #saveFooter': 'saveFooter' + }, + initialize: function() { + _.bindAll(this); + this.template = _.template($('#footer-config-template').html()); + }, + render: function() { + $('#page').remove(); + $('#content-container').append(this.$el); + this.$el.html(this.template()); + M.editor.wysiwig('#footer-input'); + }, + saveFooter: function() { + tinymce.triggerSave(false, true); + var data = $('#footer-input').html(); + console.log(data); + } + }); + /* view to configure custom navigation menu */ var MenuConfigView = Backbone.View.extend({ tagName: 'div', -- 1.7.10.4