diff --git a/build/bundle.js b/build/bundle.js index dec7b535..53efafe5 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -6494,7 +6494,8 @@ var Level = Sandbox.extend({ el: this.goalCanvasHolder.getCanvasLocation(), containerElement: this.goalCanvasHolder.getCanvasLocation(), treeString: this.goalTreeString, - noKeyboardInput: true + noKeyboardInput: true, + noClick: true }); }, @@ -6607,7 +6608,6 @@ var Level = Sandbox.extend({ afterCB: _.bind(this.afterCommandCB, this), afterDeferHandler: _.bind(this.afterCommandDefer, this) }); - console.log('made my git shim'); }, getCommandsThatCount: function() { @@ -6712,6 +6712,18 @@ var Level = Sandbox.extend({ return instants; }, + startLevel: function(command, deferred) { + command.addWarning( + "You are in a level! You can't start a new one before exiting. I'll add the command for you..." + ); + command.set('status', 'error'); + + Main.getEventBaton().trigger('commandSubmitted', + 'delay 3000; exit level; delay 500;' + command.get('rawStr') + ); + deferred.resolve(); + }, + exitLevel: function(command, deferred) { this.die(); setTimeout(function() { @@ -6855,7 +6867,8 @@ var Visualization = Backbone.View.extend({ this.gitVisuals = new GitVisuals({ commitCollection: this.commitCollection, branchCollection: this.branchCollection, - paper: this.paper + paper: this.paper, + noClick: this.options.noClick }); var GitEngine = require('../git').GitEngine; @@ -7363,6 +7376,7 @@ GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) { }; GitEngine.prototype.tearDown = function() { + this.eventBaton.releaseBaton('processGitCommand', this.dispatch, this); this.removeAll(); }; @@ -12720,6 +12734,8 @@ var VisEdge = require('../visuals/visEdge').VisEdge; var VisEdgeCollection = require('../visuals/visEdge').VisEdgeCollection; function GitVisuals(options) { + options = options || {}; + this.options = options; this.commitCollection = options.commitCollection; this.branchCollection = options.branchCollection; this.visNodeMap = {}; @@ -13800,6 +13816,9 @@ var VisNode = VisBase.extend({ }, attachClickHandlers: function() { + if (this.get('gitVisuals').options.noClick) { + return; + } var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); _.each([this.get('circle'), this.get('text')], function(rObj) { @@ -14282,6 +14301,9 @@ var VisBranch = VisBase.extend({ }, attachClickHandlers: function() { + if (this.get('gitVisuals').options.noClick) { + return; + } var commandStr = 'git checkout ' + this.get('branch').get('id'); var Main = require('../app'); var objs = [this.get('rect'), this.get('text'), this.get('arrow')]; @@ -14705,8 +14727,7 @@ exports.GitShim = GitShim; }); -require.define("/src/js/views/multiView.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError; -var _ = require('underscore'); +require.define("/src/js/views/multiView.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); var Q = require('q'); // horrible hack to get localStorage Backbone plugin var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; @@ -14718,6 +14739,8 @@ var LeftRightView = require('../views').LeftRightView; var ModalAlert = require('../views').ModalAlert; var KeyboardListener = require('../util/keyboard').KeyboardListener; +var GitError = require('../util/errors').GitError; + var MultiView = Backbone.View.extend({ tagName: 'div', className: 'multiView', @@ -16258,6 +16281,7 @@ GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) { }; GitEngine.prototype.tearDown = function() { + this.eventBaton.releaseBaton('processGitCommand', this.dispatch, this); this.removeAll(); }; @@ -17825,6 +17849,10 @@ exports.TreeCompare = TreeCompare; }); require("/src/js/git/treeCompare.js"); +require.define("/src/js/level/arbiter.js",function(require,module,exports,__dirname,__filename,process,global){ +}); +require("/src/js/level/arbiter.js"); + require.define("/src/js/level/commands.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); var regexMap = { @@ -18015,7 +18043,8 @@ var Level = Sandbox.extend({ el: this.goalCanvasHolder.getCanvasLocation(), containerElement: this.goalCanvasHolder.getCanvasLocation(), treeString: this.goalTreeString, - noKeyboardInput: true + noKeyboardInput: true, + noClick: true }); }, @@ -18128,7 +18157,6 @@ var Level = Sandbox.extend({ afterCB: _.bind(this.afterCommandCB, this), afterDeferHandler: _.bind(this.afterCommandDefer, this) }); - console.log('made my git shim'); }, getCommandsThatCount: function() { @@ -18233,6 +18261,18 @@ var Level = Sandbox.extend({ return instants; }, + startLevel: function(command, deferred) { + command.addWarning( + "You are in a level! You can't start a new one before exiting. I'll add the command for you..." + ); + command.set('status', 'error'); + + Main.getEventBaton().trigger('commandSubmitted', + 'delay 3000; exit level; delay 500;' + command.get('rawStr') + ); + deferred.resolve(); + }, + exitLevel: function(command, deferred) { this.die(); setTimeout(function() { @@ -19734,6 +19774,22 @@ exports.CommandLineHistoryView = CommandLineHistoryView; }); require("/src/js/views/commandViews.js"); +require.define("/src/js/views/gitDemonstrationView.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); +var Q = require('q'); +// horrible hack to get localStorage Backbone plugin +var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; + +var ModalTerminal = require('../views').ModalTerminal; +var ContainedBase = require('../views').ContainedBase; +var ConfirmCancelView = require('../views').ConfirmCancelView; +var LeftRightView = require('../views').LeftRightView; +var ModalAlert = require('../views').ModalAlert; +var KeyboardListener = require('../util/keyboard').KeyboardListener; + + +}); +require("/src/js/views/gitDemonstrationView.js"); + require.define("/src/js/views/index.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError; var _ = require('underscore'); var Q = require('q'); @@ -20187,8 +20243,7 @@ exports.LevelToolbar = LevelToolbar; }); require("/src/js/views/index.js"); -require.define("/src/js/views/multiView.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError; -var _ = require('underscore'); +require.define("/src/js/views/multiView.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); var Q = require('q'); // horrible hack to get localStorage Backbone plugin var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; @@ -20200,6 +20255,8 @@ var LeftRightView = require('../views').LeftRightView; var ModalAlert = require('../views').ModalAlert; var KeyboardListener = require('../util/keyboard').KeyboardListener; +var GitError = require('../util/errors').GitError; + var MultiView = Backbone.View.extend({ tagName: 'div', className: 'multiView', @@ -20895,6 +20952,8 @@ var VisEdge = require('../visuals/visEdge').VisEdge; var VisEdgeCollection = require('../visuals/visEdge').VisEdgeCollection; function GitVisuals(options) { + options = options || {}; + this.options = options; this.commitCollection = options.commitCollection; this.branchCollection = options.branchCollection; this.visNodeMap = {}; @@ -22024,6 +22083,9 @@ var VisBranch = VisBase.extend({ }, attachClickHandlers: function() { + if (this.get('gitVisuals').options.noClick) { + return; + } var commandStr = 'git checkout ' + this.get('branch').get('id'); var Main = require('../app'); var objs = [this.get('rect'), this.get('text'), this.get('arrow')]; @@ -22636,6 +22698,9 @@ var VisNode = VisBase.extend({ }, attachClickHandlers: function() { + if (this.get('gitVisuals').options.noClick) { + return; + } var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); _.each([this.get('circle'), this.get('text')], function(rObj) { @@ -22805,7 +22870,8 @@ var Visualization = Backbone.View.extend({ this.gitVisuals = new GitVisuals({ commitCollection: this.commitCollection, branchCollection: this.branchCollection, - paper: this.paper + paper: this.paper, + noClick: this.options.noClick }); var GitEngine = require('../git').GitEngine; diff --git a/src/js/git/index.js b/src/js/git/index.js index c99d3f86..0065d3bc 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -258,6 +258,7 @@ GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) { }; GitEngine.prototype.tearDown = function() { + this.eventBaton.releaseBaton('processGitCommand', this.dispatch, this); this.removeAll(); }; diff --git a/src/js/level/arbiter.js b/src/js/level/arbiter.js new file mode 100644 index 00000000..e69de29b diff --git a/src/js/level/index.js b/src/js/level/index.js index bc3fc89c..34bbe2d5 100644 --- a/src/js/level/index.js +++ b/src/js/level/index.js @@ -114,7 +114,8 @@ var Level = Sandbox.extend({ el: this.goalCanvasHolder.getCanvasLocation(), containerElement: this.goalCanvasHolder.getCanvasLocation(), treeString: this.goalTreeString, - noKeyboardInput: true + noKeyboardInput: true, + noClick: true }); }, @@ -227,7 +228,6 @@ var Level = Sandbox.extend({ afterCB: _.bind(this.afterCommandCB, this), afterDeferHandler: _.bind(this.afterCommandDefer, this) }); - console.log('made my git shim'); }, getCommandsThatCount: function() { @@ -332,6 +332,18 @@ var Level = Sandbox.extend({ return instants; }, + startLevel: function(command, deferred) { + command.addWarning( + "You are in a level! You can't start a new one before exiting. I'll add the command for you..." + ); + command.set('status', 'error'); + + Main.getEventBaton().trigger('commandSubmitted', + 'delay 3000; exit level; delay 500;' + command.get('rawStr') + ); + deferred.resolve(); + }, + exitLevel: function(command, deferred) { this.die(); setTimeout(function() { diff --git a/src/js/views/multiView.js b/src/js/views/multiView.js index a44b7672..419b3a76 100644 --- a/src/js/views/multiView.js +++ b/src/js/views/multiView.js @@ -1,4 +1,3 @@ -var GitError = require('../util/errors').GitError; var _ = require('underscore'); var Q = require('q'); // horrible hack to get localStorage Backbone plugin @@ -11,6 +10,8 @@ var LeftRightView = require('../views').LeftRightView; var ModalAlert = require('../views').ModalAlert; var KeyboardListener = require('../util/keyboard').KeyboardListener; +var GitError = require('../util/errors').GitError; + var MultiView = Backbone.View.extend({ tagName: 'div', className: 'multiView', diff --git a/src/js/visuals/index.js b/src/js/visuals/index.js index 1ecfadf7..5b539ef3 100644 --- a/src/js/visuals/index.js +++ b/src/js/visuals/index.js @@ -16,6 +16,8 @@ var VisEdge = require('../visuals/visEdge').VisEdge; var VisEdgeCollection = require('../visuals/visEdge').VisEdgeCollection; function GitVisuals(options) { + options = options || {}; + this.options = options; this.commitCollection = options.commitCollection; this.branchCollection = options.branchCollection; this.visNodeMap = {}; diff --git a/src/js/visuals/visBranch.js b/src/js/visuals/visBranch.js index b3f096ad..3f3d4f31 100644 --- a/src/js/visuals/visBranch.js +++ b/src/js/visuals/visBranch.js @@ -313,6 +313,9 @@ var VisBranch = VisBase.extend({ }, attachClickHandlers: function() { + if (this.get('gitVisuals').options.noClick) { + return; + } var commandStr = 'git checkout ' + this.get('branch').get('id'); var Main = require('../app'); var objs = [this.get('rect'), this.get('text'), this.get('arrow')]; diff --git a/src/js/visuals/visNode.js b/src/js/visuals/visNode.js index 872e573a..ac24293e 100644 --- a/src/js/visuals/visNode.js +++ b/src/js/visuals/visNode.js @@ -314,6 +314,9 @@ var VisNode = VisBase.extend({ }, attachClickHandlers: function() { + if (this.get('gitVisuals').options.noClick) { + return; + } var commandStr = 'git checkout ' + this.get('commit').get('id'); var Main = require('../app'); _.each([this.get('circle'), this.get('text')], function(rObj) { diff --git a/src/js/visuals/visualization.js b/src/js/visuals/visualization.js index b3dbecb3..55fffe1f 100644 --- a/src/js/visuals/visualization.js +++ b/src/js/visuals/visualization.js @@ -47,7 +47,8 @@ var Visualization = Backbone.View.extend({ this.gitVisuals = new GitVisuals({ commitCollection: this.commitCollection, branchCollection: this.branchCollection, - paper: this.paper + paper: this.paper, + noClick: this.options.noClick }); var GitEngine = require('../git').GitEngine; diff --git a/todo.txt b/todo.txt index 32fa886d..a18be11a 100644 --- a/todo.txt +++ b/todo.txt @@ -5,13 +5,10 @@ Big Graphic things: ~~~~~~~~~~~~~~~~~~~~~~~~~ [ ] levels dropdown selection? [ ] git demonstration view -[ ] sandbox can launch and takedown levels Medium things: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Commands -======== +[ ] level arbiter (has everything by ID) Small things to implement: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -21,7 +18,6 @@ Minor Bugs to fix: Big Bugs to fix: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -[ ] click handlers on goal visualization for the actual canvas elements /************************************* ** Publish Things ** @@ -32,6 +28,11 @@ Big Bugs to fix: Done things: (I only started this on Dec 17th 2012 to get a better sense of what was done) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[x] click handlers on goal visualization for the actual canvas elements +[x] sandbox can launch and takedown levels +[x] TWO epic bugs squashed: + * Raphael process.nextTick needed + * _.debounce on prototype [x] window zoom alert thing -- this just needs to be timeouted one more time [x] level teardown [x] great die for levels