2 'libs/jquery-1.9.1.min',
\r
3 'libs/underscore-min',
\r
4 'libs/text!./template.html'
\r
5 ], function($, _, templateSrc) {
\r
9 return function(sandbox) {
\r
11 var template = _.template(templateSrc);
\r
14 dom: $('<div>' + template({children: null, parent: null}) + '</div>'),
\r
16 this.dom.on('click', 'a', function(e) {
\r
17 var target = $(e.target);
\r
18 sandbox.publish('nodeSelected', target.attr('data-id'));
\r
21 this.dom.on('mouseenter', 'a', function(e) {
\r
22 var target = $(e.target);
\r
23 sandbox.publish('nodeEntered', target.attr('data-id'));
\r
25 this.dom.on('mouseleave', 'a', function(e) {
\r
26 var target = $(e.target);
\r
27 sandbox.publish('nodeLeft', target.attr('data-id'));
\r
30 setNode: function(node) {
\r
31 var parentClass = node.parent().attr('wlxml-class');
\r
32 var parent = node.parent('[wlxml-tag]').length ? {
\r
33 repr: node.parent().attr('wlxml-tag') + (parentClass ? ' / ' + parentClass : ''),
\r
34 id: node.parent().attr('id')
\r
37 node.children('[wlxml-tag]').each(function() {
\r
38 var child = $(this);
\r
39 var childClass = child.attr('wlxml-class');
\r
40 children.push({repr: child.attr('wlxml-tag') + (childClass ? ' / ' + childClass : ''), id: child.attr('id')});
\r
43 this.dom.append($(template({parent: parent, children: children})));
\r
51 sandbox.publish('ready');
\r
53 setNode: function(node) {
\r
56 getView: function() {
\r