mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
markdown grabber
This commit is contained in:
parent
36bfd99d9e
commit
3ade2bdd71
8 changed files with 329 additions and 12 deletions
196
build/bundle.js
196
build/bundle.js
|
@ -9662,8 +9662,7 @@ exports.InteractiveRebaseView = InteractiveRebaseView;
|
|||
|
||||
});
|
||||
|
||||
require.define("/src/js/views/index.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError;
|
||||
var _ = require('underscore');
|
||||
require.define("/src/js/views/index.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;
|
||||
|
@ -9671,6 +9670,7 @@ var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.
|
|||
var Main = require('../app');
|
||||
var Constants = require('../util/constants');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
var GitError = require('../util/errors').GitError;
|
||||
|
||||
var BaseView = Backbone.View.extend({
|
||||
getDestination: function() {
|
||||
|
@ -16096,7 +16096,6 @@ var SeriesView = BaseView.extend({
|
|||
// property changing but it's the 11th hour...
|
||||
var toLoop = this.$('div.levelIcon').each(function(index, el) {
|
||||
var id = $(el).attr('data-id');
|
||||
console.log('updating id', id);
|
||||
$(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id));
|
||||
});
|
||||
},
|
||||
|
@ -16920,6 +16919,97 @@ HeadlessGit.prototype.sendCommand = function(value) {
|
|||
exports.HeadlessGit = HeadlessGit;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/views/builderViews.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 util = require('../util');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
|
||||
var Views = require('../views');
|
||||
var ModalTerminal = Views.ModalTerminal;
|
||||
var ContainedBase = Views.ContainedBase;
|
||||
|
||||
var MarkdownGrabber = ContainedBase.extend({
|
||||
tagName: 'div',
|
||||
className: 'MarkdownGrabber box horizontal',
|
||||
template: _.template($('#markdown-grabber-view').html()),
|
||||
events: {
|
||||
'keyup textarea': 'keyup'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.deferred = options.deferred || Q.defer();
|
||||
this.options = options;
|
||||
this.JSON = {};
|
||||
|
||||
this.container = new ModalTerminal({
|
||||
title: options.title || 'Enter some markdown'
|
||||
});
|
||||
this.render();
|
||||
|
||||
if (!options.withoutButton) {
|
||||
// do button stuff
|
||||
var buttonDefer = Q.defer();
|
||||
buttonDefer.promise
|
||||
.then(_.bind(function() {
|
||||
this.confirmed();
|
||||
}, this))
|
||||
.fail(_.bind(function() {
|
||||
this.cancelled();
|
||||
}, this))
|
||||
.done();
|
||||
var confirmCancel = new Views.ConfirmCancelView({
|
||||
deferred: buttonDefer,
|
||||
destination: this.getDestination()
|
||||
});
|
||||
}
|
||||
|
||||
this.updatePreview();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
confirmed: function() {
|
||||
this.die();
|
||||
this.deferred.resolve(this.getRawText());
|
||||
},
|
||||
|
||||
cancelled: function() {
|
||||
this.die();
|
||||
this.deferred.resolve();
|
||||
},
|
||||
|
||||
keyup: function() {
|
||||
if (!this.throttledPreview) {
|
||||
this.throttledPreview = _.throttle(
|
||||
_.bind(this.updatePreview, this),
|
||||
500
|
||||
);
|
||||
}
|
||||
this.throttledPreview();
|
||||
},
|
||||
|
||||
getRawText: function() {
|
||||
return this.$('textarea').val();
|
||||
},
|
||||
|
||||
updatePreview: function() {
|
||||
var raw = this.getRawText();
|
||||
var HTML = require('markdown').markdown.toHTML(raw);
|
||||
this.$('div.insidePreview').html(HTML);
|
||||
}
|
||||
});
|
||||
|
||||
exports.MarkdownGrabber = MarkdownGrabber;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/app/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
@ -21031,7 +21121,8 @@ var toGlobalize = {
|
|||
Sandbox: require('../level/sandbox'),
|
||||
GitDemonstrationView: require('../views/gitDemonstrationView'),
|
||||
Markdown: require('markdown'),
|
||||
LevelDropdownView: require('../views/levelDropdownView')
|
||||
LevelDropdownView: require('../views/levelDropdownView'),
|
||||
BuilderViews: require('../views/builderViews')
|
||||
};
|
||||
|
||||
_.each(toGlobalize, function(module) {
|
||||
|
@ -21413,6 +21504,98 @@ exports.detectZoom = detectZoom;
|
|||
});
|
||||
require("/src/js/util/zoomLevel.js");
|
||||
|
||||
require.define("/src/js/views/builderViews.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 util = require('../util');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
|
||||
var Views = require('../views');
|
||||
var ModalTerminal = Views.ModalTerminal;
|
||||
var ContainedBase = Views.ContainedBase;
|
||||
|
||||
var MarkdownGrabber = ContainedBase.extend({
|
||||
tagName: 'div',
|
||||
className: 'MarkdownGrabber box horizontal',
|
||||
template: _.template($('#markdown-grabber-view').html()),
|
||||
events: {
|
||||
'keyup textarea': 'keyup'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.deferred = options.deferred || Q.defer();
|
||||
this.options = options;
|
||||
this.JSON = {};
|
||||
|
||||
this.container = new ModalTerminal({
|
||||
title: options.title || 'Enter some markdown'
|
||||
});
|
||||
this.render();
|
||||
|
||||
if (!options.withoutButton) {
|
||||
// do button stuff
|
||||
var buttonDefer = Q.defer();
|
||||
buttonDefer.promise
|
||||
.then(_.bind(function() {
|
||||
this.confirmed();
|
||||
}, this))
|
||||
.fail(_.bind(function() {
|
||||
this.cancelled();
|
||||
}, this))
|
||||
.done();
|
||||
var confirmCancel = new Views.ConfirmCancelView({
|
||||
deferred: buttonDefer,
|
||||
destination: this.getDestination()
|
||||
});
|
||||
}
|
||||
|
||||
this.updatePreview();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
confirmed: function() {
|
||||
this.die();
|
||||
this.deferred.resolve(this.getRawText());
|
||||
},
|
||||
|
||||
cancelled: function() {
|
||||
this.die();
|
||||
this.deferred.resolve();
|
||||
},
|
||||
|
||||
keyup: function() {
|
||||
if (!this.throttledPreview) {
|
||||
this.throttledPreview = _.throttle(
|
||||
_.bind(this.updatePreview, this),
|
||||
500
|
||||
);
|
||||
}
|
||||
this.throttledPreview();
|
||||
},
|
||||
|
||||
getRawText: function() {
|
||||
return this.$('textarea').val();
|
||||
},
|
||||
|
||||
updatePreview: function() {
|
||||
var raw = this.getRawText();
|
||||
var HTML = require('markdown').markdown.toHTML(raw);
|
||||
this.$('div.insidePreview').html(HTML);
|
||||
}
|
||||
});
|
||||
|
||||
exports.MarkdownGrabber = MarkdownGrabber;
|
||||
|
||||
|
||||
});
|
||||
require("/src/js/views/builderViews.js");
|
||||
|
||||
require.define("/src/js/views/commandViews.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
var Backbone = (!require('../util').isBrowser()) ? Backbone = require('backbone') : Backbone = window.Backbone;
|
||||
|
@ -22008,8 +22191,7 @@ exports.GitDemonstrationView = GitDemonstrationView;
|
|||
});
|
||||
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');
|
||||
require.define("/src/js/views/index.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;
|
||||
|
@ -22017,6 +22199,7 @@ var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.
|
|||
var Main = require('../app');
|
||||
var Constants = require('../util/constants');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
var GitError = require('../util/errors').GitError;
|
||||
|
||||
var BaseView = Backbone.View.extend({
|
||||
getDestination: function() {
|
||||
|
@ -22871,7 +23054,6 @@ var SeriesView = BaseView.extend({
|
|||
// property changing but it's the 11th hour...
|
||||
var toLoop = this.$('div.levelIcon').each(function(index, el) {
|
||||
var id = $(el).attr('data-id');
|
||||
console.log('updating id', id);
|
||||
$(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id));
|
||||
});
|
||||
},
|
||||
|
|
20
index.html
20
index.html
|
@ -227,6 +227,26 @@
|
|||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="markdown-grabber-view">
|
||||
<div class="inputSide box vertical">
|
||||
<div class="markdownGrabberInput">
|
||||
<textarea>## Enter some markdown!</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box vertical flex1">
|
||||
<p class="helperText textAlignCenter">
|
||||
Preview
|
||||
</p>
|
||||
|
||||
<div class="markdownGrabberPreview box flex1 vertical">
|
||||
<div class="insidePreview">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/html" id="modal-alert-template">
|
||||
<h2>
|
||||
<%= title %>
|
||||
|
|
|
@ -22,7 +22,8 @@ var toGlobalize = {
|
|||
Sandbox: require('../level/sandbox'),
|
||||
GitDemonstrationView: require('../views/gitDemonstrationView'),
|
||||
Markdown: require('markdown'),
|
||||
LevelDropdownView: require('../views/levelDropdownView')
|
||||
LevelDropdownView: require('../views/levelDropdownView'),
|
||||
BuilderViews: require('../views/builderViews')
|
||||
};
|
||||
|
||||
_.each(toGlobalize, function(module) {
|
||||
|
|
88
src/js/views/builderViews.js
Normal file
88
src/js/views/builderViews.js
Normal file
|
@ -0,0 +1,88 @@
|
|||
var _ = require('underscore');
|
||||
var Q = require('q');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone;
|
||||
|
||||
var util = require('../util');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
|
||||
var Views = require('../views');
|
||||
var ModalTerminal = Views.ModalTerminal;
|
||||
var ContainedBase = Views.ContainedBase;
|
||||
|
||||
var MarkdownGrabber = ContainedBase.extend({
|
||||
tagName: 'div',
|
||||
className: 'MarkdownGrabber box horizontal',
|
||||
template: _.template($('#markdown-grabber-view').html()),
|
||||
events: {
|
||||
'keyup textarea': 'keyup'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.deferred = options.deferred || Q.defer();
|
||||
this.options = options;
|
||||
this.JSON = {};
|
||||
|
||||
this.container = new ModalTerminal({
|
||||
title: options.title || 'Enter some markdown'
|
||||
});
|
||||
this.render();
|
||||
|
||||
if (!options.withoutButton) {
|
||||
// do button stuff
|
||||
var buttonDefer = Q.defer();
|
||||
buttonDefer.promise
|
||||
.then(_.bind(function() {
|
||||
this.confirmed();
|
||||
}, this))
|
||||
.fail(_.bind(function() {
|
||||
this.cancelled();
|
||||
}, this))
|
||||
.done();
|
||||
var confirmCancel = new Views.ConfirmCancelView({
|
||||
deferred: buttonDefer,
|
||||
destination: this.getDestination()
|
||||
});
|
||||
}
|
||||
|
||||
this.updatePreview();
|
||||
|
||||
if (!options.wait) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
confirmed: function() {
|
||||
this.die();
|
||||
this.deferred.resolve(this.getRawText());
|
||||
},
|
||||
|
||||
cancelled: function() {
|
||||
this.die();
|
||||
this.deferred.resolve();
|
||||
},
|
||||
|
||||
keyup: function() {
|
||||
if (!this.throttledPreview) {
|
||||
this.throttledPreview = _.throttle(
|
||||
_.bind(this.updatePreview, this),
|
||||
500
|
||||
);
|
||||
}
|
||||
this.throttledPreview();
|
||||
},
|
||||
|
||||
getRawText: function() {
|
||||
return this.$('textarea').val();
|
||||
},
|
||||
|
||||
updatePreview: function() {
|
||||
var raw = this.getRawText();
|
||||
var HTML = require('markdown').markdown.toHTML(raw);
|
||||
this.$('div.insidePreview').html(HTML);
|
||||
}
|
||||
});
|
||||
|
||||
exports.MarkdownGrabber = MarkdownGrabber;
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
var GitError = require('../util/errors').GitError;
|
||||
var _ = require('underscore');
|
||||
var Q = require('q');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
|
@ -7,6 +6,7 @@ var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.
|
|||
var Main = require('../app');
|
||||
var Constants = require('../util/constants');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
var GitError = require('../util/errors').GitError;
|
||||
|
||||
var BaseView = Backbone.View.extend({
|
||||
getDestination: function() {
|
||||
|
|
|
@ -271,7 +271,6 @@ var SeriesView = BaseView.extend({
|
|||
// property changing but it's the 11th hour...
|
||||
var toLoop = this.$('div.levelIcon').each(function(index, el) {
|
||||
var id = $(el).attr('data-id');
|
||||
console.log('updating id', id);
|
||||
$(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id));
|
||||
});
|
||||
},
|
||||
|
|
|
@ -14,6 +14,10 @@ html, body {
|
|||
color: #eee;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
code {
|
||||
background: grey;
|
||||
padding: 4px;
|
||||
|
@ -24,6 +28,10 @@ p {
|
|||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.textAlignCenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Box Model */
|
||||
html,
|
||||
body,
|
||||
|
@ -514,6 +522,7 @@ li.rebaseEntry,
|
|||
margin-top: 30%;
|
||||
}
|
||||
|
||||
p.helperText,
|
||||
div.terminal-text p.helperText,
|
||||
.iRebaseDialog p.helperText {
|
||||
font-size: 10px;
|
||||
|
@ -728,12 +737,28 @@ div.levelIcon.solved div.index div.indexNum {
|
|||
display: none;
|
||||
}
|
||||
|
||||
/* Git demonstration view */
|
||||
/* Git demonstration view, and MarkdownGrabber */
|
||||
|
||||
.MarkdownGrabber {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.MarkdownGrabber textarea {
|
||||
width: 90%;
|
||||
height: 600px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.markdownGrabberPreview div.insidePreview {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.MarkdownGrabber > div.inputSide,
|
||||
.gitDemonstrationView > div.demonstrationText {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.MarkdownGrabber div.markdownGrabberPreview,
|
||||
.gitDemonstrationView > div.visHolder {
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
|
||||
border-radius: 3px;
|
||||
|
@ -745,6 +770,7 @@ div.levelIcon.solved div.index div.indexNum {
|
|||
padding: 10px;
|
||||
}
|
||||
|
||||
.MarkdownGrabber,
|
||||
.gitDemonstrationView {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
|
3
todo.txt
3
todo.txt
|
@ -3,9 +3,9 @@ Big Things
|
|||
[ ] level builder dialog tester
|
||||
[ ] level builder dialog builder
|
||||
|
||||
|
||||
Medium things:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[ ] get automated SHA hash appending in the html source :OOOOO... template? or what?
|
||||
|
||||
Cases to handle / things to edit
|
||||
=======================
|
||||
|
@ -31,6 +31,7 @@ Ideas for cleaning
|
|||
Done things:
|
||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[x] sandbox and level command refresh
|
||||
[x] level builder finish
|
||||
[x] level builder? :OOO
|
||||
* basically just an extension of level (or sandbox), that has commands like
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue