mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
Objective and Assignment commands Issue #76 works even in level builder
This commit is contained in:
parent
63a8d385bf
commit
e081c47e31
8 changed files with 154 additions and 28 deletions
116
build/bundle.js
116
build/bundle.js
|
@ -6018,7 +6018,8 @@ var regexMap = {
|
||||||
'start dialog': /^start dialog$/,
|
'start dialog': /^start dialog$/,
|
||||||
'show goal': /^(show goal|goal|help goal)$/,
|
'show goal': /^(show goal|goal|help goal)$/,
|
||||||
'hide goal': /^hide goal$/,
|
'hide goal': /^hide goal$/,
|
||||||
'show solution': /^show solution($|\s)/
|
'show solution': /^show solution($|\s)/,
|
||||||
|
'objective': /^(objective|assignment)$/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = util.genParseCommand(regexMap, 'processLevelCommand');
|
var parse = util.genParseCommand(regexMap, 'processLevelCommand');
|
||||||
|
@ -6066,6 +6067,31 @@ var Level = Sandbox.extend({
|
||||||
}, this.getAnimationTime() * 1.2);
|
}, this.getAnimationTime() * 1.2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
objectiveDialog: function(command, deferred, levelObj) {
|
||||||
|
levelObj = (levelObj === undefined) ? this.level : levelObj;
|
||||||
|
|
||||||
|
if (!levelObj || !levelObj.startDialog) {
|
||||||
|
command.set('error', new Errors.GitError({
|
||||||
|
msg: intl.str('no-start-dialog')
|
||||||
|
}));
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dialog = _.clone(intl.getStartDialog(levelObj));
|
||||||
|
// grab the last slide only
|
||||||
|
dialog.childViews = dialog.childViews.splice(-1);
|
||||||
|
new MultiView(_.extend(
|
||||||
|
dialog,
|
||||||
|
{ deferred: deferred }
|
||||||
|
));
|
||||||
|
|
||||||
|
// when its closed we are done
|
||||||
|
deferred.promise.then(function() {
|
||||||
|
command.set('status', 'finished');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
startDialog: function(command, deferred) {
|
startDialog: function(command, deferred) {
|
||||||
if (!this.level.startDialog) {
|
if (!this.level.startDialog) {
|
||||||
command.set('error', new Errors.GitError({
|
command.set('error', new Errors.GitError({
|
||||||
|
@ -6483,7 +6509,8 @@ var Level = Sandbox.extend({
|
||||||
'hide goal': this.hideGoal,
|
'hide goal': this.hideGoal,
|
||||||
'show solution': this.showSolution,
|
'show solution': this.showSolution,
|
||||||
'start dialog': this.startDialog,
|
'start dialog': this.startDialog,
|
||||||
'help level': this.startDialog
|
'help level': this.startDialog,
|
||||||
|
'objective': this.objectiveDialog
|
||||||
};
|
};
|
||||||
var method = methodMap[command.get('method')];
|
var method = methodMap[command.get('method')];
|
||||||
if (!method) {
|
if (!method) {
|
||||||
|
@ -13080,7 +13107,7 @@ var LevelBuilder = Level.extend({
|
||||||
};
|
};
|
||||||
LevelBuilder.__super__.initialize.apply(this, [options]);
|
LevelBuilder.__super__.initialize.apply(this, [options]);
|
||||||
|
|
||||||
this.startDialog = undefined;
|
this.startDialogObj = undefined;
|
||||||
this.definedGoal = false;
|
this.definedGoal = false;
|
||||||
|
|
||||||
// we wont be using this stuff, and its to delete to ensure we overwrite all functions that
|
// we wont be using this stuff, and its to delete to ensure we overwrite all functions that
|
||||||
|
@ -13125,6 +13152,21 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
objectiveDialog: function(command, deferred) {
|
||||||
|
var args = [
|
||||||
|
command,
|
||||||
|
deferred,
|
||||||
|
(this.startDialogObj === undefined) ?
|
||||||
|
null :
|
||||||
|
{
|
||||||
|
startDialog: {
|
||||||
|
'en_US': this.startDialogObj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
LevelBuilder.__super__.objectiveDialog.apply(this, args);
|
||||||
|
},
|
||||||
|
|
||||||
initParseWaterfall: function(options) {
|
initParseWaterfall: function(options) {
|
||||||
LevelBuilder.__super__.initParseWaterfall.apply(this, [options]);
|
LevelBuilder.__super__.initParseWaterfall.apply(this, [options]);
|
||||||
|
|
||||||
|
@ -13236,12 +13278,12 @@ var LevelBuilder = Level.extend({
|
||||||
editDialog: function(command, deferred) {
|
editDialog: function(command, deferred) {
|
||||||
var whenDoneEditing = Q.defer();
|
var whenDoneEditing = Q.defer();
|
||||||
this.currentBuilder = new MultiViewBuilder({
|
this.currentBuilder = new MultiViewBuilder({
|
||||||
multiViewJSON: this.startDialog,
|
multiViewJSON: this.startDialogObj,
|
||||||
deferred: whenDoneEditing
|
deferred: whenDoneEditing
|
||||||
});
|
});
|
||||||
whenDoneEditing.promise
|
whenDoneEditing.promise
|
||||||
.then(_.bind(function(levelObj) {
|
.then(_.bind(function(levelObj) {
|
||||||
this.startDialog = levelObj;
|
this.startDialogObj = levelObj;
|
||||||
}, this))
|
}, this))
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
// nothing to do, they dont want to edit it apparently
|
// nothing to do, they dont want to edit it apparently
|
||||||
|
@ -13293,7 +13335,7 @@ var LevelBuilder = Level.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.startDialog === undefined) {
|
if (this.startDialogObj === undefined) {
|
||||||
var askForStartDeferred = Q.defer();
|
var askForStartDeferred = Q.defer();
|
||||||
chain = chain.then(function() {
|
chain = chain.then(function() {
|
||||||
return askForStartDeferred.promise;
|
return askForStartDeferred.promise;
|
||||||
|
@ -13339,8 +13381,8 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
// the start dialog now is just our help intro thing
|
// the start dialog now is just our help intro thing
|
||||||
delete compiledLevel.startDialog;
|
delete compiledLevel.startDialog;
|
||||||
if (this.startDialog) {
|
if (this.startDialogObj) {
|
||||||
compiledLevel.startDialog = {'en_US': this.startDialog};
|
compiledLevel.startDialog = {'en_US': this.startDialogObj};
|
||||||
}
|
}
|
||||||
return compiledLevel;
|
return compiledLevel;
|
||||||
},
|
},
|
||||||
|
@ -23850,7 +23892,7 @@ var LevelBuilder = Level.extend({
|
||||||
};
|
};
|
||||||
LevelBuilder.__super__.initialize.apply(this, [options]);
|
LevelBuilder.__super__.initialize.apply(this, [options]);
|
||||||
|
|
||||||
this.startDialog = undefined;
|
this.startDialogObj = undefined;
|
||||||
this.definedGoal = false;
|
this.definedGoal = false;
|
||||||
|
|
||||||
// we wont be using this stuff, and its to delete to ensure we overwrite all functions that
|
// we wont be using this stuff, and its to delete to ensure we overwrite all functions that
|
||||||
|
@ -23895,6 +23937,21 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
objectiveDialog: function(command, deferred) {
|
||||||
|
var args = [
|
||||||
|
command,
|
||||||
|
deferred,
|
||||||
|
(this.startDialogObj === undefined) ?
|
||||||
|
null :
|
||||||
|
{
|
||||||
|
startDialog: {
|
||||||
|
'en_US': this.startDialogObj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
LevelBuilder.__super__.objectiveDialog.apply(this, args);
|
||||||
|
},
|
||||||
|
|
||||||
initParseWaterfall: function(options) {
|
initParseWaterfall: function(options) {
|
||||||
LevelBuilder.__super__.initParseWaterfall.apply(this, [options]);
|
LevelBuilder.__super__.initParseWaterfall.apply(this, [options]);
|
||||||
|
|
||||||
|
@ -24006,12 +24063,12 @@ var LevelBuilder = Level.extend({
|
||||||
editDialog: function(command, deferred) {
|
editDialog: function(command, deferred) {
|
||||||
var whenDoneEditing = Q.defer();
|
var whenDoneEditing = Q.defer();
|
||||||
this.currentBuilder = new MultiViewBuilder({
|
this.currentBuilder = new MultiViewBuilder({
|
||||||
multiViewJSON: this.startDialog,
|
multiViewJSON: this.startDialogObj,
|
||||||
deferred: whenDoneEditing
|
deferred: whenDoneEditing
|
||||||
});
|
});
|
||||||
whenDoneEditing.promise
|
whenDoneEditing.promise
|
||||||
.then(_.bind(function(levelObj) {
|
.then(_.bind(function(levelObj) {
|
||||||
this.startDialog = levelObj;
|
this.startDialogObj = levelObj;
|
||||||
}, this))
|
}, this))
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
// nothing to do, they dont want to edit it apparently
|
// nothing to do, they dont want to edit it apparently
|
||||||
|
@ -24063,7 +24120,7 @@ var LevelBuilder = Level.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.startDialog === undefined) {
|
if (this.startDialogObj === undefined) {
|
||||||
var askForStartDeferred = Q.defer();
|
var askForStartDeferred = Q.defer();
|
||||||
chain = chain.then(function() {
|
chain = chain.then(function() {
|
||||||
return askForStartDeferred.promise;
|
return askForStartDeferred.promise;
|
||||||
|
@ -24109,8 +24166,8 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
// the start dialog now is just our help intro thing
|
// the start dialog now is just our help intro thing
|
||||||
delete compiledLevel.startDialog;
|
delete compiledLevel.startDialog;
|
||||||
if (this.startDialog) {
|
if (this.startDialogObj) {
|
||||||
compiledLevel.startDialog = {'en_US': this.startDialog};
|
compiledLevel.startDialog = {'en_US': this.startDialogObj};
|
||||||
}
|
}
|
||||||
return compiledLevel;
|
return compiledLevel;
|
||||||
},
|
},
|
||||||
|
@ -24230,7 +24287,8 @@ var regexMap = {
|
||||||
'start dialog': /^start dialog$/,
|
'start dialog': /^start dialog$/,
|
||||||
'show goal': /^(show goal|goal|help goal)$/,
|
'show goal': /^(show goal|goal|help goal)$/,
|
||||||
'hide goal': /^hide goal$/,
|
'hide goal': /^hide goal$/,
|
||||||
'show solution': /^show solution($|\s)/
|
'show solution': /^show solution($|\s)/,
|
||||||
|
'objective': /^(objective|assignment)$/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = util.genParseCommand(regexMap, 'processLevelCommand');
|
var parse = util.genParseCommand(regexMap, 'processLevelCommand');
|
||||||
|
@ -24278,6 +24336,31 @@ var Level = Sandbox.extend({
|
||||||
}, this.getAnimationTime() * 1.2);
|
}, this.getAnimationTime() * 1.2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
objectiveDialog: function(command, deferred, levelObj) {
|
||||||
|
levelObj = (levelObj === undefined) ? this.level : levelObj;
|
||||||
|
|
||||||
|
if (!levelObj || !levelObj.startDialog) {
|
||||||
|
command.set('error', new Errors.GitError({
|
||||||
|
msg: intl.str('no-start-dialog')
|
||||||
|
}));
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dialog = _.clone(intl.getStartDialog(levelObj));
|
||||||
|
// grab the last slide only
|
||||||
|
dialog.childViews = dialog.childViews.splice(-1);
|
||||||
|
new MultiView(_.extend(
|
||||||
|
dialog,
|
||||||
|
{ deferred: deferred }
|
||||||
|
));
|
||||||
|
|
||||||
|
// when its closed we are done
|
||||||
|
deferred.promise.then(function() {
|
||||||
|
command.set('status', 'finished');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
startDialog: function(command, deferred) {
|
startDialog: function(command, deferred) {
|
||||||
if (!this.level.startDialog) {
|
if (!this.level.startDialog) {
|
||||||
command.set('error', new Errors.GitError({
|
command.set('error', new Errors.GitError({
|
||||||
|
@ -24695,7 +24778,8 @@ var Level = Sandbox.extend({
|
||||||
'hide goal': this.hideGoal,
|
'hide goal': this.hideGoal,
|
||||||
'show solution': this.showSolution,
|
'show solution': this.showSolution,
|
||||||
'start dialog': this.startDialog,
|
'start dialog': this.startDialog,
|
||||||
'help level': this.startDialog
|
'help level': this.startDialog,
|
||||||
|
'objective': this.objectiveDialog
|
||||||
};
|
};
|
||||||
var method = methodMap[command.get('method')];
|
var method = methodMap[command.get('method')];
|
||||||
if (!method) {
|
if (!method) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.9b2f4bfd.js
Normal file
1
build/bundle.min.9b2f4bfd.js
Normal file
File diff suppressed because one or more lines are too long
2
build/bundle.min.js
vendored
2
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -412,7 +412,7 @@
|
||||||
For a much easier time perusing the source, see the individual files at:
|
For a much easier time perusing the source, see the individual files at:
|
||||||
https://github.com/pcottle/learnGitBranching
|
https://github.com/pcottle/learnGitBranching
|
||||||
-->
|
-->
|
||||||
<script src="build/bundle.min.43a1f886.js"></script>
|
<script src="build/bundle.min.9b2f4bfd.js"></script>
|
||||||
|
|
||||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||||
The downside? No raw logs to parse for analytics, so I have to include
|
The downside? No raw logs to parse for analytics, so I have to include
|
||||||
|
|
|
@ -51,7 +51,7 @@ var LevelBuilder = Level.extend({
|
||||||
};
|
};
|
||||||
LevelBuilder.__super__.initialize.apply(this, [options]);
|
LevelBuilder.__super__.initialize.apply(this, [options]);
|
||||||
|
|
||||||
this.startDialog = undefined;
|
this.startDialogObj = undefined;
|
||||||
this.definedGoal = false;
|
this.definedGoal = false;
|
||||||
|
|
||||||
// we wont be using this stuff, and its to delete to ensure we overwrite all functions that
|
// we wont be using this stuff, and its to delete to ensure we overwrite all functions that
|
||||||
|
@ -96,6 +96,21 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
objectiveDialog: function(command, deferred) {
|
||||||
|
var args = [
|
||||||
|
command,
|
||||||
|
deferred,
|
||||||
|
(this.startDialogObj === undefined) ?
|
||||||
|
null :
|
||||||
|
{
|
||||||
|
startDialog: {
|
||||||
|
'en_US': this.startDialogObj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
LevelBuilder.__super__.objectiveDialog.apply(this, args);
|
||||||
|
},
|
||||||
|
|
||||||
initParseWaterfall: function(options) {
|
initParseWaterfall: function(options) {
|
||||||
LevelBuilder.__super__.initParseWaterfall.apply(this, [options]);
|
LevelBuilder.__super__.initParseWaterfall.apply(this, [options]);
|
||||||
|
|
||||||
|
@ -207,12 +222,12 @@ var LevelBuilder = Level.extend({
|
||||||
editDialog: function(command, deferred) {
|
editDialog: function(command, deferred) {
|
||||||
var whenDoneEditing = Q.defer();
|
var whenDoneEditing = Q.defer();
|
||||||
this.currentBuilder = new MultiViewBuilder({
|
this.currentBuilder = new MultiViewBuilder({
|
||||||
multiViewJSON: this.startDialog,
|
multiViewJSON: this.startDialogObj,
|
||||||
deferred: whenDoneEditing
|
deferred: whenDoneEditing
|
||||||
});
|
});
|
||||||
whenDoneEditing.promise
|
whenDoneEditing.promise
|
||||||
.then(_.bind(function(levelObj) {
|
.then(_.bind(function(levelObj) {
|
||||||
this.startDialog = levelObj;
|
this.startDialogObj = levelObj;
|
||||||
}, this))
|
}, this))
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
// nothing to do, they dont want to edit it apparently
|
// nothing to do, they dont want to edit it apparently
|
||||||
|
@ -264,7 +279,7 @@ var LevelBuilder = Level.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.startDialog === undefined) {
|
if (this.startDialogObj === undefined) {
|
||||||
var askForStartDeferred = Q.defer();
|
var askForStartDeferred = Q.defer();
|
||||||
chain = chain.then(function() {
|
chain = chain.then(function() {
|
||||||
return askForStartDeferred.promise;
|
return askForStartDeferred.promise;
|
||||||
|
@ -310,8 +325,8 @@ var LevelBuilder = Level.extend({
|
||||||
);
|
);
|
||||||
// the start dialog now is just our help intro thing
|
// the start dialog now is just our help intro thing
|
||||||
delete compiledLevel.startDialog;
|
delete compiledLevel.startDialog;
|
||||||
if (this.startDialog) {
|
if (this.startDialogObj) {
|
||||||
compiledLevel.startDialog = {'en_US': this.startDialog};
|
compiledLevel.startDialog = {'en_US': this.startDialogObj};
|
||||||
}
|
}
|
||||||
return compiledLevel;
|
return compiledLevel;
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,7 +29,8 @@ var regexMap = {
|
||||||
'start dialog': /^start dialog$/,
|
'start dialog': /^start dialog$/,
|
||||||
'show goal': /^(show goal|goal|help goal)$/,
|
'show goal': /^(show goal|goal|help goal)$/,
|
||||||
'hide goal': /^hide goal$/,
|
'hide goal': /^hide goal$/,
|
||||||
'show solution': /^show solution($|\s)/
|
'show solution': /^show solution($|\s)/,
|
||||||
|
'objective': /^(objective|assignment)$/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = util.genParseCommand(regexMap, 'processLevelCommand');
|
var parse = util.genParseCommand(regexMap, 'processLevelCommand');
|
||||||
|
@ -77,6 +78,31 @@ var Level = Sandbox.extend({
|
||||||
}, this.getAnimationTime() * 1.2);
|
}, this.getAnimationTime() * 1.2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
objectiveDialog: function(command, deferred, levelObj) {
|
||||||
|
levelObj = (levelObj === undefined) ? this.level : levelObj;
|
||||||
|
|
||||||
|
if (!levelObj || !levelObj.startDialog) {
|
||||||
|
command.set('error', new Errors.GitError({
|
||||||
|
msg: intl.str('no-start-dialog')
|
||||||
|
}));
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dialog = _.clone(intl.getStartDialog(levelObj));
|
||||||
|
// grab the last slide only
|
||||||
|
dialog.childViews = dialog.childViews.splice(-1);
|
||||||
|
new MultiView(_.extend(
|
||||||
|
dialog,
|
||||||
|
{ deferred: deferred }
|
||||||
|
));
|
||||||
|
|
||||||
|
// when its closed we are done
|
||||||
|
deferred.promise.then(function() {
|
||||||
|
command.set('status', 'finished');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
startDialog: function(command, deferred) {
|
startDialog: function(command, deferred) {
|
||||||
if (!this.level.startDialog) {
|
if (!this.level.startDialog) {
|
||||||
command.set('error', new Errors.GitError({
|
command.set('error', new Errors.GitError({
|
||||||
|
@ -494,7 +520,8 @@ var Level = Sandbox.extend({
|
||||||
'hide goal': this.hideGoal,
|
'hide goal': this.hideGoal,
|
||||||
'show solution': this.showSolution,
|
'show solution': this.showSolution,
|
||||||
'start dialog': this.startDialog,
|
'start dialog': this.startDialog,
|
||||||
'help level': this.startDialog
|
'help level': this.startDialog,
|
||||||
|
'objective': this.objectiveDialog
|
||||||
};
|
};
|
||||||
var method = methodMap[command.get('method')];
|
var method = methodMap[command.get('method')];
|
||||||
if (!method) {
|
if (!method) {
|
||||||
|
|
2
todo.txt
2
todo.txt
|
@ -8,7 +8,6 @@ Intl TODO
|
||||||
Big Things
|
Big Things
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
[ ] compare settings for a level!!! integrated into builder...
|
[ ] compare settings for a level!!! integrated into builder...
|
||||||
[ ] hash agnotisc comparison with asserts for ammends
|
|
||||||
[ ] tree pruning
|
[ ] tree pruning
|
||||||
|
|
||||||
Medium things:
|
Medium things:
|
||||||
|
@ -34,6 +33,7 @@ Ideas for cleaning
|
||||||
Done things:
|
Done things:
|
||||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[x] hash agnotisc comparison with asserts for ammends
|
||||||
[x] level builder intl aware
|
[x] level builder intl aware
|
||||||
[x] rest of views/index translation
|
[x] rest of views/index translation
|
||||||
[x] git/index.js translation -- rest of the strings
|
[x] git/index.js translation -- rest of the strings
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue