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 sandbox.publish('nodeSelected', target.attr('data-id'));
\r
29 setNode: function(node) {
\r
31 this.dom.html(template({node: node, parents: node.parents('[wlxml-tag]')}));
\r
34 highlightNode: function(id) {
\r
35 this.dom.find('a[data-id="'+id+'"]').addClass('rng-common-hoveredNode');
\r
37 dimNode: function(id) {
\r
38 this.dom.find('a[data-id="' +id+'"]').removeClass('rng-common-hoveredNode');
\r
45 start: function() { sandbox.publish('ready'); },
\r
46 getView: function() { return view.dom; },
\r
47 setNode: function(node) { view.setNode(node); },
\r
48 highlightNode: function(id) { view.highlightNode(id); },
\r
49 dimNode: function(id) { view.dimNode(id); }
\r