mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
git demonstration co ming along
This commit is contained in:
parent
388f449ab6
commit
c1813c346c
8 changed files with 231 additions and 11 deletions
|
@ -19,7 +19,8 @@ var toGlobalize = {
|
|||
ZoomLevel: require('../util/zoomLevel'),
|
||||
VisBranch: require('../visuals/visBranch'),
|
||||
Level: require('../level'),
|
||||
Sandbox: require('../level/sandbox')
|
||||
Sandbox: require('../level/sandbox'),
|
||||
GitDemonstrationView: require('../views/gitDemonstrationView')
|
||||
};
|
||||
|
||||
_.each(toGlobalize, function(module) {
|
||||
|
|
|
@ -5,8 +5,49 @@ var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.
|
|||
|
||||
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;
|
||||
|
||||
var GitDemonstrationView = ContainedBase.extend({
|
||||
tagName: 'div',
|
||||
className: 'gitDemonstrationView box horizontal',
|
||||
template: _.template($('#git-demonstration-view').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.JSON = _.extend(
|
||||
options,
|
||||
{
|
||||
beforeMarkdowns: [
|
||||
'## Git Commits',
|
||||
'',
|
||||
'Awesome!'
|
||||
],
|
||||
command: 'git commit',
|
||||
afterMarkdowns: [
|
||||
'Now you have seen it in action',
|
||||
'',
|
||||
'Go ahead and try the level!'
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
var convert = function(markdowns) {
|
||||
return require('markdown').markdown.toHTML(markdowns.join('\n'));
|
||||
};
|
||||
|
||||
this.JSON.beforeHTML = convert(this.JSON.beforeMarkdowns);
|
||||
this.JSON.afterHTML = convert(this.JSON.afterMarkdowns);
|
||||
|
||||
this.container = new ModalTerminal({
|
||||
title: options.title || 'Git Demonstration'
|
||||
});
|
||||
this.render();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.GitDemonstrationView = GitDemonstrationView;
|
||||
|
||||
|
|
|
@ -263,6 +263,10 @@ var ModalAlert = ContainedBase.extend({
|
|||
title: 'Alert!'
|
||||
});
|
||||
this.render();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
|
|
@ -140,7 +140,11 @@ var MultiView = Backbone.View.extend({
|
|||
if (!this.typeToConstructor[type]) {
|
||||
throw new Error('no constructor for type "' + type + '"');
|
||||
}
|
||||
var view = new this.typeToConstructor[type](viewJSON.options);
|
||||
var view = new this.typeToConstructor[type](_.extend(
|
||||
{},
|
||||
viewJSON.options,
|
||||
{ wait: true }
|
||||
));
|
||||
return view;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue