mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 17:00:04 +02:00
rollup stuff
This commit is contained in:
parent
866749bad5
commit
44322298ba
4 changed files with 35 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue