From: Aleksander Ɓukasz Date: Wed, 17 Apr 2013 13:54:41 +0000 (+0200) Subject: Visual editor - working sidebar X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/153ea475b5d188797738c961411ca8d019101b9a?hp=39305f915559082f17b7a5b8fd7521ee05181fec Visual editor - working sidebar --- diff --git a/modules/visualEditor.js b/modules/visualEditor.js index 9721d29..d152acd 100644 --- a/modules/visualEditor.js +++ b/modules/visualEditor.js @@ -96,7 +96,33 @@ rng.modules.visualEditor = function(sandbox) { return newRow; } }; + + + var sideBarView = { + node: view.node.find('#rng-visualEditor-sidebar'), + setup: function() { + var view = this; + this.node.find('#rng-visualEditor-sidebarButtons a').click(function(e) { + e.preventDefault(); + var target = $(e.currentTarget); + if(!target.attr('data-content-id')) + return; + view.selectTab(target.attr('data-content-id')); + }); + view.selectTab('rng-visualEditor-edit'); + }, + selectTab: function(id) { + this.node.find('.rng-visualEditor-sidebarContentItem').hide(); + this.node.find('#'+id).show(); + this.node.find('#rng-visualEditor-sidebarButtons li').removeClass('active'); + this.node.find('#rng-visualEditor-sidebarButtons li a[data-content-id=' + id + ']').parent().addClass('active'); + + } + + } + view.setup(); + sideBarView.setup(); var isDirty = false;