mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-03 03:04:27 +02:00
BOOM removed helper bar view look at those stats brah
This commit is contained in:
parent
4fd4fc93fe
commit
ce5fc82ca9
7 changed files with 305 additions and 286 deletions
|
@ -560,265 +560,6 @@ var ZoomAlertWindow = ViewportAlert.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var HelperBar = BaseView.extend({
|
||||
getClassName: function() {
|
||||
return 'BaseHelperBar';
|
||||
},
|
||||
|
||||
tagName: 'div',
|
||||
className: 'helperBar transitionAll',
|
||||
template: _.template($('#helper-bar-template').html()),
|
||||
events: {
|
||||
'click a': 'onClick'
|
||||
},
|
||||
|
||||
onClick: function(ev) {
|
||||
var target = ev.target;
|
||||
var id = $(target).attr('data-id');
|
||||
var funcName = 'on' + id[0].toUpperCase() + id.slice(1) + 'Click';
|
||||
this[funcName].call(this);
|
||||
},
|
||||
|
||||
show: function() {
|
||||
this.$el.toggleClass('show', true);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.$el.toggleClass('show', false);
|
||||
if (this.deferred) {
|
||||
this.deferred.resolve();
|
||||
}
|
||||
},
|
||||
|
||||
getItems: function() {
|
||||
return [];
|
||||
},
|
||||
|
||||
setupChildren: function() {
|
||||
},
|
||||
|
||||
fireCommand: function(command) {
|
||||
Main.getEventBaton().trigger('commandSubmitted', command);
|
||||
},
|
||||
|
||||
showDeferMe: function(otherBar) {
|
||||
this.hide();
|
||||
|
||||
var whenClosed = Q.defer();
|
||||
otherBar.deferred = whenClosed;
|
||||
whenClosed.promise.then(_.bind(function() {
|
||||
this.show();
|
||||
}, this));
|
||||
otherBar.show();
|
||||
},
|
||||
|
||||
onExitClick: function() {
|
||||
this.hide();
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.destination = $('body');
|
||||
|
||||
this.JSON = {
|
||||
items: this.getItems()
|
||||
};
|
||||
this.render();
|
||||
this.$el.addClass(this.getClassName());
|
||||
this.setupChildren();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var IntlHelperBar = HelperBar.extend({
|
||||
getClassName: function() {
|
||||
return 'IntlHelperBar';
|
||||
},
|
||||
|
||||
getItems: function() {
|
||||
return [{
|
||||
text: 'Git Branching',
|
||||
id: 'english'
|
||||
}, {
|
||||
text: '日本語版リポジトリ',
|
||||
id: 'japanese'
|
||||
}, {
|
||||
text: 'Git 브랜치 배우기',
|
||||
id: 'korean'
|
||||
}, {
|
||||
text: '学习 Git 分支',
|
||||
id: 'simpchinese'
|
||||
}, {
|
||||
text: '學習 Git 分支',
|
||||
id: 'tradchinese'
|
||||
}, {
|
||||
text: 'español',
|
||||
id: 'spanish'
|
||||
}, {
|
||||
text: 'português',
|
||||
id: 'portuguese'
|
||||
}, {
|
||||
text: 'français',
|
||||
id: 'french'
|
||||
}, {
|
||||
text: 'Deutsch',
|
||||
id: 'german'
|
||||
}, {
|
||||
icon: 'signout',
|
||||
id: 'exit'
|
||||
}];
|
||||
},
|
||||
|
||||
fireCommand: function() {
|
||||
log.viewInteracted('intlSelect');
|
||||
HelperBar.prototype.fireCommand.apply(this, arguments);
|
||||
},
|
||||
|
||||
onJapaneseClick: function() {
|
||||
this.fireCommand('locale ja; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onEnglishClick: function() {
|
||||
this.fireCommand('locale en_US; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onKoreanClick: function() {
|
||||
this.fireCommand('locale ko; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onSpanishClick: function() {
|
||||
this.fireCommand('locale es_AR; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onPortugueseClick: function() {
|
||||
this.fireCommand('locale pt_BR; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onFrenchClick: function() {
|
||||
this.fireCommand('locale fr_FR; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onGermanClick: function() {
|
||||
this.fireCommand('locale de_DE; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onSimpchineseClick: function() {
|
||||
this.fireCommand('locale zh_CN; levels');
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onTradchineseClick: function() {
|
||||
this.fireCommand('locale zh_TW; levels');
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
var CommandsHelperBar = HelperBar.extend({
|
||||
getClassName: function() {
|
||||
return 'CommandsHelperBar';
|
||||
},
|
||||
|
||||
getItems: function() {
|
||||
return [{
|
||||
text: 'Levels',
|
||||
id: 'levels'
|
||||
}, {
|
||||
text: 'Solution',
|
||||
id: 'solution'
|
||||
}, {
|
||||
text: 'Reset',
|
||||
id: 'reset'
|
||||
}, {
|
||||
text: 'Undo',
|
||||
id: 'undo'
|
||||
}, {
|
||||
text: 'Objective',
|
||||
id: 'objective'
|
||||
}, {
|
||||
text: 'Help',
|
||||
id: 'help'
|
||||
}, {
|
||||
icon: 'signout',
|
||||
id: 'exit'
|
||||
}];
|
||||
},
|
||||
|
||||
fireCommand: function() {
|
||||
log.viewInteracted('helperBar');
|
||||
HelperBar.prototype.fireCommand.apply(this, arguments);
|
||||
},
|
||||
|
||||
onSolutionClick: function() {
|
||||
this.fireCommand('show solution');
|
||||
},
|
||||
|
||||
onObjectiveClick: function() {
|
||||
this.fireCommand('objective');
|
||||
},
|
||||
|
||||
onLevelsClick: function() {
|
||||
this.fireCommand('levels');
|
||||
},
|
||||
|
||||
onResetClick: function() {
|
||||
this.fireCommand('reset');
|
||||
},
|
||||
|
||||
onUndoClick: function() {
|
||||
this.fireCommand('undo');
|
||||
},
|
||||
|
||||
onHelpClick: function() {
|
||||
this.fireCommand('help general; git help');
|
||||
}
|
||||
});
|
||||
|
||||
var MainHelperBar = HelperBar.extend({
|
||||
getItems: function() {
|
||||
return [{
|
||||
icon: 'question-sign',
|
||||
id: 'commands'
|
||||
}, {
|
||||
icon: 'globe',
|
||||
id: 'intl'
|
||||
}, {
|
||||
newPageLink: true,
|
||||
icon: 'facebook',
|
||||
id: 'fb',
|
||||
href: 'https://www.facebook.com/LearnGitBranching'
|
||||
}];
|
||||
},
|
||||
|
||||
onFbClick: function() {
|
||||
log.viewInteracted('fbPageLink');
|
||||
},
|
||||
|
||||
onIntlClick: function() {
|
||||
this.showDeferMe(this.intlHelper);
|
||||
log.viewInteracted('openIntlBar');
|
||||
},
|
||||
|
||||
onCommandsClick: function() {
|
||||
this.showDeferMe(this.commandsHelper);
|
||||
log.viewInteracted('openCommandsBar');
|
||||
},
|
||||
|
||||
setupChildren: function() {
|
||||
this.commandsHelper = new CommandsHelperBar({ wait: true });
|
||||
this.intlHelper = new IntlHelperBar({ wait: true});
|
||||
}
|
||||
});
|
||||
|
||||
var CanvasTerminalHolder = BaseView.extend({
|
||||
tagName: 'div',
|
||||
className: 'canvasTerminalHolder box flex1',
|
||||
|
@ -966,8 +707,5 @@ exports.ZoomAlertWindow = ZoomAlertWindow;
|
|||
exports.ConfirmCancelTerminal = ConfirmCancelTerminal;
|
||||
exports.WindowSizeAlertWindow = WindowSizeAlertWindow;
|
||||
|
||||
exports.MainHelperBar = MainHelperBar;
|
||||
|
||||
exports.CanvasTerminalHolder = CanvasTerminalHolder;
|
||||
exports.NextLevelConfirm = NextLevelConfirm;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue