mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
#937 - Fix advancing to the next screen
This commit is contained in:
parent
aa8f51713f
commit
7a55e66b37
1 changed files with 10 additions and 11 deletions
|
@ -20,7 +20,8 @@ var GitDemonstrationView = ContainedBase.extend({
|
||||||
template: _.template($('#git-demonstration-view').html()),
|
template: _.template($('#git-demonstration-view').html()),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click div.command > p.uiButton': 'positive'
|
'click div.command > p.uiButton:not([target="reset"])': 'positive',
|
||||||
|
'click div.command > p.uiButton[target="reset"]': 'onResetButtonClick',
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
@ -59,6 +60,7 @@ var GitDemonstrationView = ContainedBase.extend({
|
||||||
this.navEvents = Object.assign({}, Backbone.Events);
|
this.navEvents = Object.assign({}, Backbone.Events);
|
||||||
this.navEvents.on('positive', this.positive, this);
|
this.navEvents.on('positive', this.positive, this);
|
||||||
this.navEvents.on('negative', this.negative, this);
|
this.navEvents.on('negative', this.negative, this);
|
||||||
|
this.navEvents.on('onResetButtonClick', this.onResetButtonClick, this);
|
||||||
this.keyboardListener = new KeyboardListener({
|
this.keyboardListener = new KeyboardListener({
|
||||||
events: this.navEvents,
|
events: this.navEvents,
|
||||||
aliasMap: {
|
aliasMap: {
|
||||||
|
@ -129,25 +131,22 @@ var GitDemonstrationView = ContainedBase.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
positive: function() {
|
positive: function() {
|
||||||
if (!this.hasControl) {
|
if (this.demonstrated || !this.hasControl) {
|
||||||
// don't do anything if we are demonstrating, and if
|
// don't do anything if we are demonstrating, and if
|
||||||
// we receive a meta nav event and we aren't listening,
|
// we receive a meta nav event and we aren't listening,
|
||||||
// then don't do anything either
|
// then don't do anything either
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// already demonstrated, let's reset demonstration
|
|
||||||
if(this.demonstrated) {
|
|
||||||
this.reset();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.demonstrated = true;
|
this.demonstrated = true;
|
||||||
this.demonstrate();
|
this.demonstrate();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onResetButtonClick: function() {
|
||||||
|
this.takeControl();
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
demonstrate: function() {
|
demonstrate: function() {
|
||||||
this.releaseControl();
|
|
||||||
this.$el.toggleClass('demonstrating', true);
|
this.$el.toggleClass('demonstrating', true);
|
||||||
|
|
||||||
var whenDone = Q.defer();
|
var whenDone = Q.defer();
|
||||||
|
@ -155,7 +154,7 @@ var GitDemonstrationView = ContainedBase.extend({
|
||||||
whenDone.promise.then(function() {
|
whenDone.promise.then(function() {
|
||||||
this.$el.toggleClass('demonstrating', false);
|
this.$el.toggleClass('demonstrating', false);
|
||||||
this.$el.toggleClass('demonstrated', true);
|
this.$el.toggleClass('demonstrated', true);
|
||||||
this.takeControl();
|
this.releaseControl();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue