Issue #70 dont mark as solved when using solution show

This commit is contained in:
Peter Cottle 2013-03-06 19:53:08 -08:00
parent 94d354af22
commit 92bd248c18
7 changed files with 87 additions and 39 deletions

View file

@ -7356,16 +7356,17 @@ var Level = Sandbox.extend({
showSolution: function(command, deferred) {
var toIssue = this.level.solutionCommand;
var issueFunc = function() {
var issueFunc = _.bind(function() {
this.isShowingSolution = true;
Main.getEventBaton().trigger(
'commandSubmitted',
toIssue
);
};
}, this);
var commandStr = command.get('rawStr');
if (!this.testOptionOnString(commandStr, 'noReset')) {
toIssue = 'reset; ' + toIssue;
toIssue = 'reset --forSolution; ' + toIssue;
}
if (this.testOptionOnString(commandStr, 'force')) {
issueFunc();
@ -7375,13 +7376,9 @@ var Level = Sandbox.extend({
// allow them for force the solution
var confirmDefer = Q.defer();
// TODO intl
var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0];
var confirmView = new ConfirmCancelTerminal({
markdowns: [
'## Are you sure you want to see the solution?',
'',
'I believe in you! You can do it'
],
markdowns: dialog.options.markdowns,
deferred: confirmDefer
});
@ -7555,7 +7552,10 @@ var Level = Sandbox.extend({
levelSolved: function(defer) {
this.solved = true;
if (!this.isShowingSolution) {
Main.getEvents().trigger('levelSolved', this.level.id);
}
this.hideGoal();
var nextLevel = Main.getLevelArbiter().getNextLevel(this.level.id);
@ -7636,8 +7636,13 @@ var Level = Sandbox.extend({
];
},
reset: function() {
reset: function(command, deferred) {
this.gitCommandsIssued = [];
var commandStr = (command) ? command.get('rawStr') : '';
if (!this.testOptionOnString(commandStr, 'forSolution')) {
this.isShowingSolution = false;
}
this.solved = false;
Level.__super__.reset.apply(this, arguments);
},
@ -14055,7 +14060,7 @@ var instantCommands = [
var regexMap = {
'reset solved': /^reset solved($|\s)/,
'help': /^help( +general)?$|^\?$/,
'reset': /^reset$/,
'reset': /^reset( +--forSolution)?$/,
'delay': /^delay (\d+)$/,
'clear': /^clear($|\s)/,
'exit level': /^exit level($|\s)/,
@ -17529,6 +17534,22 @@ DisabledMap.prototype.getInstantCommands = function() {
exports.DisabledMap = DisabledMap;
});
require.define("/src/js/dialogs/confirmShowSolution.js",function(require,module,exports,__dirname,__filename,process,global){exports.dialog = {
'en_US': [{
type: 'ModalAlert',
options: {
markdowns: [
'## Are you sure you want to see the solution?',
'',
'I believe in you! You can do it'
]
}
}]
};
});
require.define("/src/js/level/arbiter.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
@ -20982,6 +21003,23 @@ exports.init = init;
});
require("/src/js/app/index.js");
require.define("/src/js/dialogs/confirmShowSolution.js",function(require,module,exports,__dirname,__filename,process,global){exports.dialog = {
'en_US': [{
type: 'ModalAlert',
options: {
markdowns: [
'## Are you sure you want to see the solution?',
'',
'I believe in you! You can do it'
]
}
}]
};
});
require("/src/js/dialogs/confirmShowSolution.js");
require.define("/src/js/dialogs/levelBuilder.js",function(require,module,exports,__dirname,__filename,process,global){exports.dialog = {
'en_US': [{
type: 'ModalAlert',
@ -24983,16 +25021,17 @@ var Level = Sandbox.extend({
showSolution: function(command, deferred) {
var toIssue = this.level.solutionCommand;
var issueFunc = function() {
var issueFunc = _.bind(function() {
this.isShowingSolution = true;
Main.getEventBaton().trigger(
'commandSubmitted',
toIssue
);
};
}, this);
var commandStr = command.get('rawStr');
if (!this.testOptionOnString(commandStr, 'noReset')) {
toIssue = 'reset; ' + toIssue;
toIssue = 'reset --forSolution; ' + toIssue;
}
if (this.testOptionOnString(commandStr, 'force')) {
issueFunc();
@ -25002,13 +25041,9 @@ var Level = Sandbox.extend({
// allow them for force the solution
var confirmDefer = Q.defer();
// TODO intl
var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0];
var confirmView = new ConfirmCancelTerminal({
markdowns: [
'## Are you sure you want to see the solution?',
'',
'I believe in you! You can do it'
],
markdowns: dialog.options.markdowns,
deferred: confirmDefer
});
@ -25182,7 +25217,10 @@ var Level = Sandbox.extend({
levelSolved: function(defer) {
this.solved = true;
if (!this.isShowingSolution) {
Main.getEvents().trigger('levelSolved', this.level.id);
}
this.hideGoal();
var nextLevel = Main.getLevelArbiter().getNextLevel(this.level.id);
@ -25263,8 +25301,13 @@ var Level = Sandbox.extend({
];
},
reset: function() {
reset: function(command, deferred) {
this.gitCommandsIssued = [];
var commandStr = (command) ? command.get('rawStr') : '';
if (!this.testOptionOnString(commandStr, 'forSolution')) {
this.isShowingSolution = false;
}
this.solved = false;
Level.__super__.reset.apply(this, arguments);
},
@ -25942,7 +25985,7 @@ var instantCommands = [
var regexMap = {
'reset solved': /^reset solved($|\s)/,
'help': /^help( +general)?$|^\?$/,
'reset': /^reset$/,
'reset': /^reset( +--forSolution)?$/,
'delay': /^delay (\d+)$/,
'clear': /^clear($|\s)/,
'exit level': /^exit level($|\s)/,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
build/bundle.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -412,7 +412,7 @@
For a much easier time perusing the source, see the individual files at:
https://github.com/pcottle/learnGitBranching
-->
<script src="build/bundle.min.598fe9d4.js"></script>
<script src="build/bundle.min.3da7a96b.js"></script>
<!-- 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

View file

@ -152,16 +152,17 @@ var Level = Sandbox.extend({
showSolution: function(command, deferred) {
var toIssue = this.level.solutionCommand;
var issueFunc = function() {
var issueFunc = _.bind(function() {
this.isShowingSolution = true;
Main.getEventBaton().trigger(
'commandSubmitted',
toIssue
);
};
}, this);
var commandStr = command.get('rawStr');
if (!this.testOptionOnString(commandStr, 'noReset')) {
toIssue = 'reset; ' + toIssue;
toIssue = 'reset --forSolution; ' + toIssue;
}
if (this.testOptionOnString(commandStr, 'force')) {
issueFunc();
@ -171,13 +172,9 @@ var Level = Sandbox.extend({
// allow them for force the solution
var confirmDefer = Q.defer();
// TODO intl
var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0];
var confirmView = new ConfirmCancelTerminal({
markdowns: [
'## Are you sure you want to see the solution?',
'',
'I believe in you! You can do it'
],
markdowns: dialog.options.markdowns,
deferred: confirmDefer
});
@ -351,7 +348,10 @@ var Level = Sandbox.extend({
levelSolved: function(defer) {
this.solved = true;
if (!this.isShowingSolution) {
Main.getEvents().trigger('levelSolved', this.level.id);
}
this.hideGoal();
var nextLevel = Main.getLevelArbiter().getNextLevel(this.level.id);
@ -432,8 +432,13 @@ var Level = Sandbox.extend({
];
},
reset: function() {
reset: function(command, deferred) {
this.gitCommandsIssued = [];
var commandStr = (command) ? command.get('rawStr') : '';
if (!this.testOptionOnString(commandStr, 'forSolution')) {
this.isShowingSolution = false;
}
this.solved = false;
Level.__super__.reset.apply(this, arguments);
},

View file

@ -71,7 +71,7 @@ var instantCommands = [
var regexMap = {
'reset solved': /^reset solved($|\s)/,
'help': /^help( +general)?$|^\?$/,
'reset': /^reset$/,
'reset': /^reset( +--forSolution)?$/,
'delay': /^delay (\d+)$/,
'clear': /^clear($|\s)/,
'exit level': /^exit level($|\s)/,