click handlers

This commit is contained in:
Peter Cottle 2012-12-25 17:31:34 -08:00
parent 9ddfaf2f18
commit ee02aea414
6 changed files with 65 additions and 18 deletions

View file

@ -307,10 +307,24 @@ var VisBranch = VisBase.extend({
.attr(this.getAttributes().arrow);
this.set('arrow', arrow);
this.attachClickHandlers();
rect.toFront();
text.toFront();
},
attachClickHandlers: function() {
var commandStr = 'git checkout ' + this.get('branch').get('id');
var Main = require('../app');
var objs = [this.get('rect'), this.get('text'), this.get('arrow')];
_.each(objs, function(rObj) {
rObj.click(function() {
Main.getEvents().trigger('processCommandFromEvent', commandStr);
});
$(rObj.node).css('cursor', 'pointer');
});
},
updateName: function() {
this.get('text').attr({
text: this.getName()