diff --git a/README b/README index daa857a6..5dc21f01 100644 --- a/README +++ b/README @@ -5,4 +5,6 @@ Hi Nikita Kouevda Maksim Ioffe +Dan Miller + diff --git a/src/commandModel.js b/src/commandModel.js index a6e21cf4..56a0f3bd 100644 --- a/src/commandModel.js +++ b/src/commandModel.js @@ -150,6 +150,13 @@ var Command = Backbone.Model.extend({ throw new CommandResult({ 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 _.each(this.getSandboxCommands(), function(tuple) { var regex = tuple[0]; - if (regex.exec(str)) { - tuple[1](); + var results = regex.exec(str); + if (results) { + tuple[1](results); } }); @@ -181,7 +189,7 @@ var Command = Backbone.Model.extend({ // see if begins with git if (str.slice(0,3) !== 'git') { throw new CommandProcessError({ - msg: 'Git commands only, sorry!' + msg: 'That command is not supported, sorry!' }); } diff --git a/src/commandViews.js b/src/commandViews.js index bb0fc158..35d13b02 100644 --- a/src/commandViews.js +++ b/src/commandViews.js @@ -39,6 +39,7 @@ var CommandPromptView = Backbone.View.extend({ events.on('processCommandFromEvent', this.addToCollection, this); events.on('submitCommandValueFromEvent', this.submitValue, this); + events.on('rollupCommands', this.rollupCommands, this); // hacky timeout focus setTimeout(_.bind(function() { @@ -186,6 +187,22 @@ var CommandPromptView = Backbone.View.extend({ 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) { // we should add if it's not a blank line and this is a new command... // or if we edited the command diff --git a/src/tree.js b/src/tree.js index 561bc254..1d91717a 100644 --- a/src/tree.js +++ b/src/tree.js @@ -559,6 +559,11 @@ var VisNode = VisBase.extend({ this.get('circle').stop().animate(attr.circle, 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() {