mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
Issue #70 dont mark as solved when using solution show
This commit is contained in:
parent
94d354af22
commit
92bd248c18
7 changed files with 87 additions and 39 deletions
|
@ -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;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
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);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue