diff --git a/build/bundle.js b/build/bundle.js index 56d9a94a..86e93772 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -11667,8 +11667,9 @@ var CommandPromptView = Backbone.View.extend({ }, submitValue: function(value) { - // we should add if it's not a blank line and this is a new command... - // or if we edited the command + // we should add the command to our local storage history + // if it's not a blank line and this is a new command... + // or if we edited the command in place var shouldAdd = (value.length && this.index == -1) || ((value.length && this.index !== -1 && this.commands.toArray()[this.index].get('text') !== value)); @@ -11700,7 +11701,6 @@ var CommandPromptView = Backbone.View.extend({ } }); - // This is the view for all commands -- it will represent // their status (inqueue, processing, finished, error), // their value ("git commit --amend"), @@ -11831,7 +11831,6 @@ var CommandLineHistoryView = Backbone.View.extend({ exports.CommandPromptView = CommandPromptView; exports.CommandLineHistoryView = CommandLineHistoryView; - }); require.define("/src/js/util/keyboard.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); @@ -12962,12 +12961,13 @@ var VisNode = VisBase.extend({ }, attachClickHandlers: function() { - var commandStr = 'git show ' + this.get('commit').get('id'); + var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); _.each([this.get('circle'), this.get('text')], function(rObj) { rObj.click(function() { Main.getEvents().trigger('processCommandFromEvent', commandStr); }); + $(rObj.node).css('cursor', 'pointer'); }); }, @@ -13437,10 +13437,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() @@ -13913,13 +13927,14 @@ var MultiView = Backbone.View.extend({ // other views will take if they need to this.keyboardListener.mute(); require('../app').getUI().modalEnd(); - this.deferred.resolve(); setTimeout(_.bind(function() { _.each(this.childViews, function(childView) { childView.tearDown(); }); }, this), this.deathTime); + + this.deferred.resolve(); }, start: function() { @@ -16860,8 +16875,9 @@ var CommandPromptView = Backbone.View.extend({ }, submitValue: function(value) { - // we should add if it's not a blank line and this is a new command... - // or if we edited the command + // we should add the command to our local storage history + // if it's not a blank line and this is a new command... + // or if we edited the command in place var shouldAdd = (value.length && this.index == -1) || ((value.length && this.index !== -1 && this.commands.toArray()[this.index].get('text') !== value)); @@ -16893,7 +16909,6 @@ var CommandPromptView = Backbone.View.extend({ } }); - // This is the view for all commands -- it will represent // their status (inqueue, processing, finished, error), // their value ("git commit --amend"), @@ -17024,7 +17039,6 @@ var CommandLineHistoryView = Backbone.View.extend({ exports.CommandPromptView = CommandPromptView; exports.CommandLineHistoryView = CommandLineHistoryView; - }); require("/src/js/views/commandViews.js"); @@ -17367,13 +17381,14 @@ var MultiView = Backbone.View.extend({ // other views will take if they need to this.keyboardListener.mute(); require('../app').getUI().modalEnd(); - this.deferred.resolve(); setTimeout(_.bind(function() { _.each(this.childViews, function(childView) { childView.tearDown(); }); }, this), this.deathTime); + + this.deferred.resolve(); }, start: function() { @@ -19049,10 +19064,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() @@ -19651,12 +19680,13 @@ var VisNode = VisBase.extend({ }, attachClickHandlers: function() { - var commandStr = 'git show ' + this.get('commit').get('id'); + var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); _.each([this.get('circle'), this.get('text')], function(rObj) { rObj.click(function() { Main.getEvents().trigger('processCommandFromEvent', commandStr); }); + $(rObj.node).css('cursor', 'pointer'); }); }, diff --git a/src/js/views/commandViews.js b/src/js/views/commandViews.js index 4c70d0fb..d34e5b4b 100644 --- a/src/js/views/commandViews.js +++ b/src/js/views/commandViews.js @@ -227,8 +227,9 @@ var CommandPromptView = Backbone.View.extend({ }, submitValue: function(value) { - // we should add if it's not a blank line and this is a new command... - // or if we edited the command + // we should add the command to our local storage history + // if it's not a blank line and this is a new command... + // or if we edited the command in place var shouldAdd = (value.length && this.index == -1) || ((value.length && this.index !== -1 && this.commands.toArray()[this.index].get('text') !== value)); @@ -260,7 +261,6 @@ var CommandPromptView = Backbone.View.extend({ } }); - // This is the view for all commands -- it will represent // their status (inqueue, processing, finished, error), // their value ("git commit --amend"), @@ -390,4 +390,3 @@ var CommandLineHistoryView = Backbone.View.extend({ exports.CommandPromptView = CommandPromptView; exports.CommandLineHistoryView = CommandLineHistoryView; - diff --git a/src/js/views/multiView.js b/src/js/views/multiView.js index 9dd2849a..befa63b4 100644 --- a/src/js/views/multiView.js +++ b/src/js/views/multiView.js @@ -121,13 +121,14 @@ var MultiView = Backbone.View.extend({ // other views will take if they need to this.keyboardListener.mute(); require('../app').getUI().modalEnd(); - this.deferred.resolve(); setTimeout(_.bind(function() { _.each(this.childViews, function(childView) { childView.tearDown(); }); }, this), this.deathTime); + + this.deferred.resolve(); }, start: function() { diff --git a/src/js/visuals/visBranch.js b/src/js/visuals/visBranch.js index 8ebcc815..fd132236 100644 --- a/src/js/visuals/visBranch.js +++ b/src/js/visuals/visBranch.js @@ -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() diff --git a/src/js/visuals/visNode.js b/src/js/visuals/visNode.js index f9236e6e..338364f9 100644 --- a/src/js/visuals/visNode.js +++ b/src/js/visuals/visNode.js @@ -314,12 +314,13 @@ var VisNode = VisBase.extend({ }, attachClickHandlers: function() { - var commandStr = 'git show ' + this.get('commit').get('id'); + var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); _.each([this.get('circle'), this.get('text')], function(rObj) { rObj.click(function() { Main.getEvents().trigger('processCommandFromEvent', commandStr); }); + $(rObj.node).css('cursor', 'pointer'); }); }, diff --git a/todo.txt b/todo.txt index c8d8793e..5c762566 100644 --- a/todo.txt +++ b/todo.txt @@ -12,6 +12,7 @@ Commands ======== [ ] sip from buffer with post-command hooks. ideally the git engine knows nothing about the level being played +[ ] refactor 'processCommand' [ ] text input from the commandPromptView must flow down into filters. no hacky stuff anymore where it's part of the option parser, wtf @@ -34,6 +35,7 @@ Big Bugs to fix: Done things: (I only started this on Dec 17th 2012 to get a better sense of what was done) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[x] better click events on branches and commits [x] change to returning a promise for multiview [x] multiViews with multiple terminals... [x] debounce the forward and back methods