mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-03 11:14:27 +02:00
PARTIAL level toolbar rewrite
This commit is contained in:
parent
a4ea49c3b8
commit
9206820a8d
6 changed files with 99 additions and 94 deletions
|
@ -559,62 +559,6 @@ var ZoomAlertWindow = ViewportAlert.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var LevelToolbar = BaseView.extend({
|
||||
tagName: 'div',
|
||||
className: 'levelToolbarHolder',
|
||||
template: _.template($('#level-toolbar-template').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.parent = options.parent;
|
||||
this.JSON = {
|
||||
name: options.name || 'Some level! (unknown name)'
|
||||
};
|
||||
|
||||
this.beforeDestination = $($('#commandLineHistory div.toolbar')[0]);
|
||||
this.render();
|
||||
|
||||
this.$goalButton = this.$el.find('#show-goal');
|
||||
this.$objectiveButton = this.$el.find('#show-objective');
|
||||
|
||||
var parent = this.parent;
|
||||
this.$goalButton.on('click', function () {
|
||||
parent.trigger('toggleGoal');
|
||||
});
|
||||
this.$objectiveButton.on('click', function() {
|
||||
parent.trigger('toggleObjective');
|
||||
});
|
||||
|
||||
if (!options.wait) {
|
||||
process.nextTick(_.bind(this.show, this));
|
||||
}
|
||||
},
|
||||
|
||||
getAnimationTime: function() { return 700; },
|
||||
|
||||
render: function() {
|
||||
var HTML = this.template(this.JSON);
|
||||
|
||||
this.$el.html(HTML);
|
||||
this.beforeDestination.after(this.el);
|
||||
},
|
||||
|
||||
die: function() {
|
||||
this.hide();
|
||||
setTimeout(_.bind(function() {
|
||||
this.tearDown();
|
||||
}, this), this.getAnimationTime());
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.$('div.toolbar').toggleClass('hidden', true);
|
||||
},
|
||||
|
||||
show: function() {
|
||||
this.$('div.toolbar').toggleClass('hidden', false);
|
||||
}
|
||||
});
|
||||
|
||||
var HelperBar = BaseView.extend({
|
||||
getClassName: function() {
|
||||
return 'BaseHelperBar';
|
||||
|
@ -1024,6 +968,5 @@ exports.WindowSizeAlertWindow = WindowSizeAlertWindow;
|
|||
exports.MainHelperBar = MainHelperBar;
|
||||
|
||||
exports.CanvasTerminalHolder = CanvasTerminalHolder;
|
||||
exports.LevelToolbar = LevelToolbar;
|
||||
exports.NextLevelConfirm = NextLevelConfirm;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue