2 'libs/jquery-1.9.1.min',
\r
3 'libs/underscore-min',
\r
4 'libs/text!./template.html'], function($, _, templateSrc) {
\r
8 return function(sandbox) {
\r
10 var template = _.template(templateSrc);
\r
13 dom: $('<div>' + template({node:null, parents: null}) + '</div>'),
\r
15 this.dom.on('mouseenter', 'a', function(e) {
\r
16 var target = $(e.target);
\r
17 sandbox.publish('nodeHighlighted', target.attr('data-id'));
\r
19 this.dom.on('mouseleave', 'a', function(e) {
\r
20 var target = $(e.target);
\r
21 sandbox.publish('nodeDimmed', target.attr('data-id'));
\r
23 this.dom.on('click', 'a', function(e) {
\r
25 var target = $(e.target);
\r
26 sandbox.publish('nodeSelected', target.attr('data-id'));
\r
30 setNode: function(node) {
\r
32 this.dom.html(template({node: node, parents: node.parents('[wlxml-tag]')}));
\r
35 highlightNode: function(id) {
\r
36 this.dom.find('a[data-id="'+id+'"]').addClass('rng-common-hoveredNode');
\r
38 dimNode: function(id) {
\r
39 this.dom.find('a[data-id="' +id+'"]').removeClass('rng-common-hoveredNode');
\r
46 start: function() { sandbox.publish('ready'); },
\r
47 getView: function() { return view.dom; },
\r
48 setNode: function(node) { view.setNode(node); },
\r
49 highlightNode: function(id) { view.highlightNode(id); },
\r
50 dimNode: function(id) { view.dimNode(id); }
\r