2 'libs/jquery-1.9.1.min',
4 'libs/text!./template.html'], function($, _, templateSrc) {
8 return function(sandbox) {
10 var template = _.template(templateSrc);
13 dom: $('<div>' + template({node:null, parents: null}) + '</div>'),
16 this.dom.on('mouseenter', 'a', function(e) {
17 var target = $(e.target);
18 sandbox.publish('nodeHighlighted', view.nodes[target.attr('data-id')]);
20 this.dom.on('mouseleave', 'a', function(e) {
21 var target = $(e.target);
22 sandbox.publish('nodeDimmed', view.nodes[target.attr('data-id')]);
24 this.dom.on('click', 'a', function(e) {
26 var target = $(e.target);
27 sandbox.publish('nodeSelected', view.nodes[target.attr('data-id')]);
31 setNode: function(node) {
33 var nodes = this.nodes = {};
34 this.currentNode = node;
35 this.nodes[node.getId()] = node;
36 var parents = node.parents();
37 parents.each(function() {
39 nodes[parent.getId()] = parent;
41 this.dom.html(template({node: node, parents: parents}));
44 highlightNode: function(node) {
45 this.dom.find('a[data-id="'+node.id+'"]').addClass('rng-common-hoveredNode');
47 dimNode: function(node) {
48 this.dom.find('a[data-id="'+node.id+'"]').removeClass('rng-common-hoveredNode');
55 start: function() { sandbox.publish('ready'); },
56 getView: function() { return view.dom; },
57 setNode: function(canvasNode) {
58 if(!canvasNode.isSame(view.currentNode)) {
59 view.setNode(canvasNode);
62 highlightNode: function(id) { view.highlightNode(id); },
63 dimNode: function(id) { view.dimNode(id); }