mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 09:20:03 +02:00
rollup stuff
This commit is contained in:
parent
866749bad5
commit
44322298ba
4 changed files with 35 additions and 3 deletions
2
README
2
README
|
@ -5,4 +5,6 @@ Hi
|
||||||
|
|
||||||
Nikita Kouevda
|
Nikita Kouevda
|
||||||
Maksim Ioffe
|
Maksim Ioffe
|
||||||
|
Dan Miller
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,13 @@ var Command = Backbone.Model.extend({
|
||||||
throw new CommandResult({
|
throw new CommandResult({
|
||||||
msg: "Refreshing tree..."
|
msg: "Refreshing tree..."
|
||||||
});
|
});
|
||||||
|
}],
|
||||||
|
[/^rollup (\d+)$/, function(bits) {
|
||||||
|
// go roll up these commands by joining them with semicolons
|
||||||
|
events.trigger('rollupCommands', bits[1]);
|
||||||
|
throw new CommandResult({
|
||||||
|
msg: 'Commands combined!'
|
||||||
|
});
|
||||||
}]
|
}]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
@ -164,8 +171,9 @@ var Command = Backbone.Model.extend({
|
||||||
// then check if it's one of our sandbox commands
|
// then check if it's one of our sandbox commands
|
||||||
_.each(this.getSandboxCommands(), function(tuple) {
|
_.each(this.getSandboxCommands(), function(tuple) {
|
||||||
var regex = tuple[0];
|
var regex = tuple[0];
|
||||||
if (regex.exec(str)) {
|
var results = regex.exec(str);
|
||||||
tuple[1]();
|
if (results) {
|
||||||
|
tuple[1](results);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -181,7 +189,7 @@ var Command = Backbone.Model.extend({
|
||||||
// see if begins with git
|
// see if begins with git
|
||||||
if (str.slice(0,3) !== 'git') {
|
if (str.slice(0,3) !== 'git') {
|
||||||
throw new CommandProcessError({
|
throw new CommandProcessError({
|
||||||
msg: 'Git commands only, sorry!'
|
msg: 'That command is not supported, sorry!'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ var CommandPromptView = Backbone.View.extend({
|
||||||
|
|
||||||
events.on('processCommandFromEvent', this.addToCollection, this);
|
events.on('processCommandFromEvent', this.addToCollection, this);
|
||||||
events.on('submitCommandValueFromEvent', this.submitValue, this);
|
events.on('submitCommandValueFromEvent', this.submitValue, this);
|
||||||
|
events.on('rollupCommands', this.rollupCommands, this);
|
||||||
|
|
||||||
// hacky timeout focus
|
// hacky timeout focus
|
||||||
setTimeout(_.bind(function() {
|
setTimeout(_.bind(function() {
|
||||||
|
@ -186,6 +187,22 @@ var CommandPromptView = Backbone.View.extend({
|
||||||
this.submitValue(value);
|
this.submitValue(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
rollupCommands: function(numBack) {
|
||||||
|
var which = this.commands.toArray().slice(1, Number(numBack) + 1);
|
||||||
|
console.log(this.commands.toArray());
|
||||||
|
console.log(which);
|
||||||
|
var str = '';
|
||||||
|
_.each(which, function(commandEntry) {
|
||||||
|
str += commandEntry.get('text') + ';';
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
console.log('the str', str);
|
||||||
|
|
||||||
|
var rolled = new CommandEntry({text: str});
|
||||||
|
this.commands.unshift(rolled);
|
||||||
|
Backbone.sync('create', rolled, function() { });
|
||||||
|
},
|
||||||
|
|
||||||
submitValue: function(value) {
|
submitValue: function(value) {
|
||||||
// we should add if it's not a blank line and this is a new command...
|
// we should add if it's not a blank line and this is a new command...
|
||||||
// or if we edited the command
|
// or if we edited the command
|
||||||
|
|
|
@ -559,6 +559,11 @@ var VisNode = VisBase.extend({
|
||||||
|
|
||||||
this.get('circle').stop().animate(attr.circle, s, e);
|
this.get('circle').stop().animate(attr.circle, s, e);
|
||||||
this.get('text').stop().animate(attr.text, s, e);
|
this.get('text').stop().animate(attr.text, s, e);
|
||||||
|
|
||||||
|
// animate the x attribute without bouncing so it looks like there's
|
||||||
|
// gravity in only one direction. Just a small animation polish
|
||||||
|
this.get('circle').animate(attr.circle.cx, s, 'easeInOut');
|
||||||
|
this.get('text').animate(attr.text.x, s, 'easeInOut');
|
||||||
},
|
},
|
||||||
|
|
||||||
getScreenCoords: function() {
|
getScreenCoords: function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue