1 define(['libs/jquery-1.9.1.min', 'libs/underscore-min', 'libs/text!./template.html'], function($, _, template) {
5 return function(sandbox) {
8 node: $(_.template(template)()),
12 this.node.find('button').click(function(e) {
14 var btn = $(e.currentTarget);
15 if(btn.attr('data-btn-type') === 'toggle') {
16 btn.toggleClass('active');
18 var btnId = btn.attr('data-btn');
23 sandbox.publish(event, btn.hasClass('active'));
25 if(btn.attr('data-btn-type') === 'cmd') {
26 var command = btn.attr('data-btn');
27 var meta = btn.attr('data-meta');
28 if(command === 'new-node') {
29 var wlxmlTag = view.getOption('newTag-tag');
30 var wlxmlClass = view.getOption('newTag-class');
32 var split = meta.split('/');
34 wlxmlClass = split[1];
36 sandbox.publish('newNodeRequested', wlxmlTag, wlxmlClass);
38 sandbox.publish('command', btn.attr('data-btn'), btn.attr('data-meta'));
43 getOption: function(option) {
44 return this.node.find('.rng-module-documentToolbar-toolbarOption[data-option=' + option +']').val();
51 start: function() { sandbox.publish('ready'); },
52 getView: function() { return view.node; },
53 getOption: function(option) { return view.getOption(option); }