Skip to content

Commit 39c09f4

Browse files
committed
Merging master into mountain directive
2 parents b610e1a + 0c0a220 commit 39c09f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+18956
-1268
lines changed

gulpfile.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ var gulp = require('gulp'),
44
concat = require('gulp-concat'),
55
// uglify = require('gulp-uglify'),
66
uglifycss = require('gulp-uglifycss'),
7+
stripCode = require('gulp-strip-code'),
78
ngAnnotate = require('gulp-ng-annotate'),
8-
watcher = gulp.watch(['./main/**/*.js', './main/styles/*.scss', './main/**/*.html', './main/jquery.js'], ['default']);
9+
watcher = gulp.watch(['./main/**/*.js', './main/styles/*.scss', './main/**/*.html', './main/jquery.js', './main/ng-webworker.js', './main/worker_wrapper.js', './main/ui-ace.js'], ['default']);
910

1011
gulp.watch(['./main/**/*.js', './main/styles/*.scss', './main/**/*.html', './main/jquery.js'], ['default']);
1112
watcher.on('change', function(event) {
@@ -23,7 +24,7 @@ gulp.task('styles', function() { // .scss is newer file version of .sass
2324
});
2425

2526
gulp.task('javascript', function() {
26-
gulp.src(['./main/**/*.js', '!./main/jquery.js'])
27+
gulp.src(['./main/**/*.js', '!./main/jquery.js', '!./main/ng-webworker.js', '!./main/worker_wrapper.js', '!./main/ui-ace.js'])
2728
.pipe(ngAnnotate())
2829
// .pipe(uglify())
2930
.pipe(concat('all.js'))
@@ -42,4 +43,5 @@ gulp.task('html', function() {
4243
.pipe(gulp.dest('./public/html/'))
4344
});
4445

46+
4547
gulp.task('default', ['styles', 'javascript', 'html', 'jquery']);

main/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angular.module('myApp', ['ui.router'])
1+
angular.module('myApp', ['ui.router', 'ui.ace', 'ngWebworker'])
22

33
.config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
44

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
angular.module('myApp')
22

3-
.controller('assessmentController', function($scope, assessmentService) {
3+
.controller('assessmentController', function($scope, assessmentService, workerService) {
44

5-
$scope.getAssessment = () => {
6-
assessmentService.getLesson().then((assessment) => {
7-
$scope.assessment = assessment;
5+
assessmentService.getAssessment().then(function(response) {
6+
var list = [];
7+
_.each(response, function(item) {
8+
for (var i = 0; i < item.questions.length; i++) {
9+
list.push(item.questions[i]);
10+
}
811
})
9-
}
12+
// console.log(list);
13+
$scope.questions = list;
14+
});
1015

11-
var editor = ace.edit("editor");
12-
editor.setTheme("ace/theme/chrome");
13-
editor.getSession().setMode("ace/mode/javascript");
16+
$scope.eval = function(q, userCode) {
1417

15-
var editor_1 = ace.edit("editor_1");
16-
editor_1.setTheme("ace/theme/chrome");
17-
editor_1.getSession().setMode("ace/mode/javascript");
1818

19-
})
19+
let qId = q._id;
20+
let answer = q.answer;
21+
22+
workerService.worker(qId, answer, userCode).then(function(result) {
23+
assessmentService.ticker(result);
24+
})
25+
26+
}
27+
28+
$scope.submitAssessment = (length) => {
29+
assessmentService.submitAssessment(length);
30+
}
31+
32+
$scope.doSomeStuff = function(q) {
33+
q.disabled = true;
34+
}
35+
36+
37+
});
Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,43 @@
1-
angular.module('myApp').service('assessmentService', function($q, $http) {
1+
angular.module('myApp')
2+
3+
.service('assessmentService', function($q, $http) {
24

35

46
this.getAssessment = () => {
57
return $http({
68
method: 'GET',
79
url: '/api/assessment/js'
810
}).then((response) => {
9-
return response;
11+
12+
return response.data;
1013
})
1114
}
15+
16+
var tick = 0;
17+
this.ticker = (result) => {
18+
if (result === true) {
19+
tick += 1;
20+
}else {
21+
return 0;
22+
}
23+
console.log("tick count", tick);
24+
}
25+
26+
27+
this.submitAssessment = (length) => {
28+
var totalScore = (tick / length) * 100;
29+
totalScore = totalScore.toString();
30+
console.log(totalScore);
31+
return $http({
32+
method: 'PUT',
33+
url: '/api/users',
34+
data: {
35+
progress: {
36+
jsAssessment: totalScore
37+
}
38+
}
39+
}).success(function(resp) {
40+
console.log(resp);
41+
})
42+
}
1243
})
Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
11
#assessment-view {
2-
32
.code-input-wrapper {
43
display: flex;
54
justify-content: center;
65
margin: 10px 0 10px 0;
76
}
8-
#editor {
9-
height: 20vh;
10-
width: 90vw;
11-
}
12-
#editor_1 {
13-
height: 20vh;
14-
width: 90vw;
7+
.ace_editor {
8+
height : 200px;
159
}
1610
.assessment-eval {
11+
color: #fff;
12+
margin: 1em;
13+
}
14+
button {
15+
background: #406BB2;
16+
padding: 10px 16px;
17+
width: auto;
18+
font-weight: 600;
19+
text-transform: uppercase;
20+
font-size: 14px;
21+
color: #fff;
22+
line-height: 16px;
23+
letter-spacing: 0.5px;
24+
border-radius: 2px;
25+
box-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 3px 6px rgba(0,0,0,0.1);
26+
border: 0;
27+
outline: 0;
28+
transition: all 0.25s;
29+
}
30+
button:hover {
31+
background: #8FB9FF;
32+
box-shadow: 0 4px 7px rgba(0,0,0,0.1), 0 3px 6px rgba(0,0,0,0.1);
33+
}
34+
button:disabled {
35+
visibility: hidden;
36+
}
37+
.stuff {
1738
color: #406BB2;
18-
display: flex;
19-
justify-content: flex-end;
39+
width: 90vw;
2040
margin: 1em;
2141
}
22-
span:hover {
23-
color: #8FB9FF;
42+
input {
43+
width: 100vw;
44+
height: 20vh;
2445
}
2546
}
Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
<navigation-directive></navigation-directive>
22
<section ng-controller="assessmentController" id=assessment-view>
3-
4-
<div class="code-input-wrapper">
5-
<div class="container">
6-
<div class="panel panel-default">
7-
<div class="panel-body">
8-
<div id="editor">function foo(items) {
9-
var x = "All this is syntax highlighted";
10-
return x;
11-
} </div>
12-
</div>
13-
</div>
14-
</div>
15-
</div>
16-
<a class="assessment-eval" href="#"><span >Submit Answer</span></a>
17-
18-
<div class="code-input-wrapper">
19-
<div class="container">
20-
<div class="panel panel-default">
21-
<div class="panel-body">
22-
<div id="editor_1">function yoda(jedi) {
23-
var sith = "Yoda will always win";
24-
return x;
25-
} </div>
26-
</div>
27-
</div>
28-
</div>
29-
</div>
30-
<a class="assessment-eval" href="#"><span >Submit Answer</span></a>
31-
3+
<div ng-repeat="q in questions" class="stuff">
4+
Q: {{q.question}}
5+
<div ng-model="userCode" ui-ace="{
6+
mode: 'javascript',
7+
theme: 'crimson_editor'
8+
}"></div>
9+
ANSWER: {{q.answer}}
10+
<button ng-click="eval(q, userCode); doSomeStuff(q);" ng-disabled="q.disabled" class="assessment-eval">eval</button>
11+
</div>
12+
<button type="button" ng-click="submitAssessment(questions.length)">Submit Assessment</button>
3213
</section>

main/assessment/worker.js

Whitespace-only changes.

main/assessment/workerService.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
angular.module('myApp').service('workerService', function(Webworker) {
2+
3+
this.worker = (qId, answer, userCode) => {
4+
5+
function isSame(userCode, answer) {
6+
if (userCode === answer) {
7+
return true;
8+
} else {
9+
return false;
10+
}
11+
}
12+
13+
var myWorker = Webworker.create(isSame, {
14+
isSame: true,
15+
onReturn: function(data) {return data;}
16+
});
17+
18+
var result = myWorker.run(userCode, answer);
19+
return result;
20+
}
21+
})

main/home/homeStyles.scss

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,32 @@ $darkBlue: #406BB2;
1414
align-items: center;
1515
z-index: -1;
1616
}
17+
// .home-top {
18+
// width: 0;
19+
// height: 0;
20+
// border-left: 19em solid transparent;
21+
// border-right: 19em solid transparent;
22+
// border-bottom: 21em solid #FFE3A8;
23+
// margin-bottom: 8vh;
24+
// margin-top: 8vh;
25+
// svg {
26+
// margin-top: 20vh;
27+
// }
1728
.home-top {
18-
width: 0;
19-
height: 0;
20-
border-left: 19em solid transparent;
21-
border-right: 19em solid transparent;
22-
border-bottom: 21em solid #FFE3A8;
23-
margin-bottom: 8vh;
24-
margin-top: 8vh;
29+
// width: 650px;
30+
// height: 360px;
31+
// background: #FFE3A8;
32+
// width: 0;
33+
// height: 0;
34+
// border-left: 300px solid transparent;
35+
// border-right: 300px solid transparent;
36+
// border-bottom: 350px solid #FFE3A8;
37+
// margin-bottom: 8vh;
38+
margin-top: 10vh;
39+
2540
div {
2641
font-weight: bold;
27-
position: absolute;
42+
// position: absolute;
2843
top: 50%;
2944
transform: translate(-50%);
3045
}

main/home/homeTemplate.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,40 @@
33
<div id="home-wrapper">
44

55

6+
<!-- <div class="home-top"> -->
7+
8+
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In -->
9+
<!-- <svg version="1.1"
10+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
11+
x="0px" y="0px" width="521.8px" height="536.1px" viewBox="0 0 521.8 536.1" style="enable-background:new 0 0 521.8 536.1;"
12+
xml:space="preserve">
13+
<style type="text/css">
14+
.st0{fill:#406BB2;}
15+
.st1{fill:#203659;}
16+
.st2{fill:#D9E1F0;}
17+
.st3{fill:none;stroke:#406BB2;stroke-width:0.25;stroke-miterlimit:10;}
18+
</style>
19+
<defs>
20+
</defs>
21+
<g id="XMLID_2_">
22+
<g>
23+
<path class="st0" d="M304,115.9c72.5,139.6,145,279.1,217.6,418.7c-89,0.6-178.1,1-267.1,1.2h0v-0.5
24+
c-2.3-116.5-4.6-232.9-6.9-349.4c0-1.4-0.1-2.8-0.1-4.1L304,115.9z"/>
25+
<path class="st1" d="M247.5,181.6L247.5,181.6c0,1.4,0.1,2.8,0.1,4.2c2.3,116.5,4.6,233,6.9,349.4v0.5
26+
c-84.7,0.2-169.5,0.2-254.2,0c63.7-140,127.4-279.9,191.1-419.9L247.5,181.6z"/>
27+
<path class="st2" d="M247.5,181.6l-56.2-65.8c17.5-38.5,35.1-77.1,52.6-115.6c0.3,15.6,0.6,31.2,0.9,46.8
28+
c0.8,42.6,1.7,85.1,2.5,127.7c0,1.8,0.1,3.6,0.1,5.3C247.5,180.6,247.5,181.1,247.5,181.6z"/>
29+
</g>
30+
<g>
31+
<path class="st3" d="M247.6,185.8c2.3,116.5,4.6,233,6.9,349.4"/>
32+
<path class="st3" d="M247.5,181.7c0,1.4,0.1,2.8,0.1,4.1"/>
33+
</g>
34+
</g>
35+
</svg> -->
36+
37+
</div> -->
38+
39+
640
<mountain-directive></mountain-directive>
741

842

0 commit comments

Comments
 (0)