Working on codemirror display issue in html coursewares
This commit is contained in:
@ -21,6 +21,17 @@ var async = require('async'),
|
|||||||
* Resources.
|
* Resources.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Array.zip = function(left, right, combinerFunction) {
|
||||||
|
var counter,
|
||||||
|
results = [];
|
||||||
|
|
||||||
|
for (counter = 0; counter < Math.min(left.length, right.length); counter++) {
|
||||||
|
results.push(combinerFunction(left[counter],right[counter]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
privacy: function privacy(req, res) {
|
privacy: function privacy(req, res) {
|
||||||
res.render('resources/privacy', {
|
res.render('resources/privacy', {
|
||||||
@ -195,6 +206,25 @@ module.exports = {
|
|||||||
req.user.progressTimestamps.push(challengesHash[key]);
|
req.user.progressTimestamps.push(challengesHash[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var timeStamps = [];
|
||||||
|
R.keys(req.user.challengesHash).forEach(function(key) {
|
||||||
|
"use strict";
|
||||||
|
timeStamps.push({timeStamp: challengesHash[key]});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.user.completedCoursewares = Array.zip(timeStamps, coursewares,
|
||||||
|
function(left, right) {
|
||||||
|
"use strict";
|
||||||
|
return ({
|
||||||
|
completedDate: left.timeStamp,
|
||||||
|
_id: right._id,
|
||||||
|
name: right.name
|
||||||
|
});
|
||||||
|
}).filter(function(elem) {
|
||||||
|
"use strict";
|
||||||
|
return elem.completedDate !== 0;
|
||||||
|
});
|
||||||
req.user.pointsNeedMigration = false;
|
req.user.pointsNeedMigration = false;
|
||||||
req.user.save();
|
req.user.save();
|
||||||
}
|
}
|
||||||
|
@ -240,30 +240,6 @@ var userSchema = new mongoose.Schema({
|
|||||||
53: {
|
53: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
|
||||||
54: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
55: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
56: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
57: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
58: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
59: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
profile: {
|
profile: {
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var widgets = [];
|
var widgets = [];
|
||||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor"), {
|
var editor = CodeMirror.fromTextArea(document.getElementById("codeEditor"), {
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
mode: "text/html",
|
mode: "text/html",
|
||||||
theme: 'monokai',
|
theme: 'monokai',
|
||||||
runnable: true,
|
runnable: true,
|
||||||
//lint: true,
|
|
||||||
matchBrackets: true,
|
matchBrackets: true,
|
||||||
autoCloseBrackets: true,
|
autoCloseBrackets: true,
|
||||||
scrollbarStyle: 'null',
|
scrollbarStyle: 'null',
|
||||||
@ -16,7 +15,6 @@ var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor")
|
|||||||
gutters: ["CodeMirror-lint-markers"],
|
gutters: ["CodeMirror-lint-markers"],
|
||||||
onKeyEvent: doLinting
|
onKeyEvent: doLinting
|
||||||
});
|
});
|
||||||
var editor = myCodeMirror;
|
|
||||||
|
|
||||||
|
|
||||||
// Hijack tab key to insert two spaces instead
|
// Hijack tab key to insert two spaces instead
|
||||||
@ -117,7 +115,7 @@ var allSeeds = '';
|
|||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
myCodeMirror.setValue(allSeeds);
|
editor.setValue('test');
|
||||||
|
|
||||||
function doLinting () {
|
function doLinting () {
|
||||||
editor.operation(function () {
|
editor.operation(function () {
|
||||||
|
@ -95,11 +95,6 @@ block content
|
|||||||
a.btn.btn-lg.btn-block.btn-info(href=website3Link, target='_blank')
|
a.btn.btn-lg.btn-block.btn-info(href=website3Link, target='_blank')
|
||||||
i.fa.icon-beaker
|
i.fa.icon-beaker
|
||||||
| Try it out
|
| Try it out
|
||||||
//
|
|
||||||
html.
|
|
||||||
<script type="text/javascript" src="//d3js.org/d3.v3.min.js"></script>
|
|
||||||
<script type="text/javascript" src="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css" />
|
|
||||||
|
|
||||||
.hidden-xs.col-sm-12
|
.hidden-xs.col-sm-12
|
||||||
#cal-heatmap
|
#cal-heatmap
|
||||||
|
Reference in New Issue
Block a user