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');
25 sandbox.publish(event, btn.hasClass('active'));
27 if(btn.attr('data-btn-type') === 'cmd') {
28 var command = btn.attr('data-btn');
29 var meta = btn.attr('data-meta');
30 if(command === 'new-node') {
31 var wlxmlTag = view.getOption('newTag-tag');
32 var wlxmlClass = view.getOption('newTag-class');
34 var split = meta.split('/');
36 wlxmlClass = split[1];
38 sandbox.publish('newNodeRequested', wlxmlTag, wlxmlClass);
40 sandbox.publish('command', btn.attr('data-btn'), btn.attr('data-meta'));
45 getOption: function(option) {
46 return this.node.find('.rng-module-documentToolbar-toolbarOption[data-option=' + option +']').val();
53 start: function() { sandbox.publish('ready'); },
54 getView: function() { return view.node; },
55 getOption: function(option) { return view.getOption(option); }