mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 17:27:22 +02:00
click handlers
This commit is contained in:
parent
9ddfaf2f18
commit
ee02aea414
6 changed files with 65 additions and 18 deletions
|
@ -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');
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
},
|
||||
|
||||
|
|
2
todo.txt
2
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue