Skip to content

Commit b1c93fb

Browse files
sandershihackerDerekTBrown
authored andcommitted
Issue #186, #198, #196 completed. (#206)
* Updated Schemas * Load Screen * Loading Screen * publish subscribe and dynamic explore page * deleted swap file * publish subscribe * template fixes * added start for reactive publication * template issue * . * . * course_records publish * course_records reactively publish * revert meteor update * publish subscribe and lineheight for searchpage icons * fixed indentation and removed test file * indentation * indentation * Accounts page and fixed random erro * toolbar for mobile devices * toolbar * account.html fixes * Toolbar made responsive * Responsive toolbar fixes * created userlist component * course_records course_id validation * indentation * markdown * import changes * validation addition * Forms Module Deprecated Warning. Issue #110 * indentation * Use routerLink * api changes (#126) * issue 32 fixed * removed swp * fixed nconf issues * issue 82, 84 fixes * fixed #82 * isse #77 * fixed tests * fixed files * fixed tests master * fixed comment * moved validator * removed duplicate file * fixed tests, removed duplicate underscore, publish * changes * fixed methods.ts import * fixed issues w methods * fixes * minor fixes * A * api changes * fixed api * comments * minor changes * minor fixes * method implementations (#127) * issue 32 fixed * removed swp * fixed nconf issues * issue 82, 84 fixes * fixed #82 * isse #77 * fixed tests * fixed files * fixed tests master * fixed comment * moved validator * removed duplicate file * fixed tests, removed duplicate underscore, publish * changes * fixed methods.ts import * fixed issues w methods * fixes * minor fixes * A * api changes * fixed api * comments * minor changes * minor fixes * method implementations * course pages now uses Child Routing * deleted LabData class * school name * search function * icon size and #136 * dashboard pull data from database * fix inappropriate file naming for gradelist and lablist * more templating issues * . * . * markdown default * lablist and gradelist * template changes * explore page changes * delete instructor page * user schema * indentation * indentation * explore publish and taskview sidenav * explore view links to course/courseId * taskview sidenav * taskview * taskview sidenav changes * Extend terminal on small width * . * . * Added UserList Component in Courses * Edit Course * . * course dashboard get courseid from url * delete userlist * input * delete userlist * publish for global admin * Fixed router params * Issue 161 fixed: instructor field in courses * . * fix nextButton * . * Issue #171 * Issue #168 * Issue 160: CourseList * Removed LabView * Enrollable field for buttons on explore pages * TaskView -> LabView * Fixed Gradelist, Lablist and styling issues * Issue #162 Completed * TaskView toolbar color darken * remove tests * Combine Subscriptions * Reactive Subscription for CourseList and GradeList * instructor view of course dashboard * Dashboard not logged in * markdown editor for labview * . * . * remove test * Syllabus update on course_dashboard for instructors works * onChange detect for mdeditor * fixed reversed md text editor * Disable links to non-accessible tasks for students * Fixed merge issues * markdown on explore * . * indentation * indentation * indentation
1 parent 30583a6 commit b1c93fb

File tree

17 files changed

+185
-107
lines changed

17 files changed

+185
-107
lines changed

client/imports/ui/components/explore/explore.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="tuxlab-exploreview">
22
<!--Tab Groups-->
3-
<md-tab-group class="md-whiteframe-5dp" *ngFor="let course of courses">
3+
<md-tab-group class="md-whiteframe-5dp" *ngFor="let course of exploreCourses">
44
<!--First Tab-->
55
<md-tab>
66
<template md-tab-label>Description</template>
@@ -27,9 +27,7 @@ <h2>{{ course.course_number }} | {{ course.course_name }}</h2>
2727
<template md-tab-content>
2828
<md-content class="md-padding">
2929
<h2>Syllabus</h2>
30-
<p>
31-
{{ course.course_description.syllabus }}
32-
</p>
30+
<div [innerHTML]="convert(course.course_description.syllabus)"></div>
3331
</md-content>
3432
</template>
3533
</md-tab>
Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,53 @@
11
// Meteor Imports
2-
import { Meteor } from 'meteor/meteor';
2+
import { Meteor } from 'meteor/meteor';
33

44
// Angular Imports
5-
import { Component } from '@angular/core';
5+
import { Component } from '@angular/core';
6+
import { ROUTER_DIRECTIVES } from '@angular/router';
67

78
// Angular Material Imports
8-
import { MATERIAL_DIRECTIVES } from 'ng2-material';
9-
import { MeteorComponent } from 'angular2-meteor';
9+
import { MATERIAL_DIRECTIVES } from 'ng2-material';
10+
import { MeteorComponent } from 'angular2-meteor';
11+
import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs';
1012

11-
// Courses Imports
12-
import { courses } from '../../../../../collections/courses.ts';
13+
// Collections
14+
declare var Collections: any;
15+
16+
/// <reference path="../markdown/marked.d.ts" />
17+
import * as marked from 'marked';
1318

1419
// Define ExploreView Component
15-
@Component({
16-
selector: 'tuxlab-exploreview',
17-
templateUrl: '/client/imports/ui/components/explore/explore.html',
18-
directives: [
19-
MATERIAL_DIRECTIVES
20-
],
21-
})
20+
@Component({
21+
selector: 'tuxlab-exploreview',
22+
templateUrl: '/client/imports/ui/components/explore/explore.html',
23+
directives: [
24+
MATERIAL_DIRECTIVES,
25+
ROUTER_DIRECTIVES,
26+
MD_TABS_DIRECTIVES
27+
],
28+
})
2229

2330
// Export ExploreView Class
2431
export class ExploreView extends MeteorComponent {
2532

26-
courses: Array<any> = [];
27-
28-
constructor() {
29-
super();
30-
31-
this.subscribe('explore-courses', () => {
32-
this.courses = courses.find().fetch();}, true);
33-
}
33+
exploreCourses: Array<any> = [];
34+
35+
constructor() {
36+
super();
37+
38+
this.subscribe('explore-courses', () => {
39+
this.exploreCourses = Collections.courses.find({ "featured": true }).fetch();
40+
}, true);
41+
}
42+
43+
// Convert to markdown
44+
convert(markdown: string) {
45+
let md = marked.setOptions({});
46+
if(typeof markdown !== "undefined" && markdown !== null) {
47+
return md.parse(markdown);
48+
}
49+
else {
50+
return "";
51+
}
52+
}
3453
}

client/imports/ui/components/explore/search.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,28 @@
33

44
// Angular Imports
55
import { Component, Input } from '@angular/core';
6+
import { ROUTER_DIRECTIVES } from '@angular/router';
67

78
// Angular Material Imports
89
import { MeteorComponent } from 'angular2-meteor';
910
import { MATERIAL_DIRECTIVES } from 'ng2-material';
1011
import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs';
1112

1213
// Courses Database Imports
13-
import { courses } from '../../../../../collections/courses.ts';
14+
import { courses } from '../../../../../collections/courses.ts';
15+
16+
// Icons
17+
import { MD_ICON_DIRECTIVES } from '@angular2-material/icon';
1418

1519
// Define SearchView Component
1620
@Component({
1721
selector: 'tuxlab-searchview',
1822
templateUrl: '/client/imports/ui/components/explore/search.html',
1923
directives: [
2024
MATERIAL_DIRECTIVES,
21-
MD_TABS_DIRECTIVES
25+
MD_TABS_DIRECTIVES,
26+
MD_ICON_DIRECTIVES,
27+
ROUTER_DIRECTIVES
2228
]
2329
})
2430

client/imports/ui/components/markdown/markdown.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<div id="task-markdown" [innerHTML]="convert(mdData)" *ngIf="!showMDE"></div>
88
<div *ngIf="showMDE" id="task-editor">
99
<tuxlab-mdeditor [mdData]="mdData" (mdUpdated)="mdUpdated($event)"></tuxlab-mdeditor>
10-
<button md-raised-button>Save Changes</button>
10+
<button md-raised-button (click)="updateMarkdown()">Save Changes</button>
1111
</div>
1212
</div>
1313
<div *ngIf="mdDataUpdate != null" id="feedback-markdown">
14-
<p>Task Feedback:</p>
14+
<p>Task Feedback:</p>
1515
<div [innerHTML]="convert(mdDataUpdate)"></div>
1616
</div>
1717
</div>

client/imports/ui/components/markdown/markdown.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
// Roles
1818
import { Roles } from '../../../../../collections/users.ts';
1919

20+
// Icons
21+
import { MD_ICON_DIRECTIVES } from '@angular2-material/icon';
22+
2023
declare var Collections: any;
2124

2225
// Markdown Imports
@@ -29,15 +32,17 @@ declare var Collections: any;
2932
templateUrl: '/client/imports/ui/components/markdown/markdown.html',
3033
directives: [
3134
MATERIAL_DIRECTIVES,
35+
MD_ICON_DIRECTIVES,
3236
MDEditor
33-
]
37+
],
3438
})
3539

3640
// Export MarkdownView Class
3741
export class MarkdownView extends MeteorComponent{
3842
@Input() mdData = "";
3943
@Input() mdDataUpdate = "";
40-
44+
@Input() taskid: number;
45+
4146
courseId: string;
4247
labId: string;
4348
showMDE: boolean = false;
@@ -75,10 +80,11 @@ export class MarkdownView extends MeteorComponent{
7580
// Update new markdown
7681
updateMarkdown() {
7782
Collections.labs.update({
78-
_id: this.labId
83+
_id: this.labId,
84+
"tasks.id": this.taskid
7985
}, {
8086
$set: {
81-
// Set current task markdown
87+
"tasks.$.md": this.mdData
8288
}
8389
});
8490
}
Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,49 @@
11
// Meteor Imports
2-
import { Meteor } from 'meteor/meteor';
3-
import { MeteorComponent } from 'angular2-meteor';
2+
import { Meteor } from 'meteor/meteor';
3+
import { MeteorComponent } from 'angular2-meteor';
44

55
// Angular Imports
6-
import { Component, ElementRef, ViewChild, Input, Output, EventEmitter } from '@angular/core';
6+
import { Component, ElementRef, ViewChild, Input, Output, EventEmitter, OnChanges } from '@angular/core';
77

88
// Declare Global Variable
9-
var SimpleMDE : any = require('simplemde');
9+
var SimpleMDE : any = require('simplemde');
1010

1111
// Define Editor Component
12-
@Component({
13-
selector: 'tuxlab-mdeditor',
14-
templateUrl: '/client/imports/ui/components/mdeditor/mdeditor.html',
15-
})
12+
@Component({
13+
selector: 'tuxlab-mdeditor',
14+
templateUrl: '/client/imports/ui/components/mdeditor/mdeditor.html',
15+
})
1616

1717
// Export Editor Class
18-
export class MDEditor extends MeteorComponent {
19-
@ViewChild('simplemde') textarea : ElementRef;
20-
@Input() mdData: string = "";
21-
@Output() mdUpdated = new EventEmitter<string>();
18+
export class MDEditor extends MeteorComponent implements OnChanges {
19+
@ViewChild('simplemde') textarea : ElementRef;
20+
@Input() mdData: string = "";
21+
@Output() mdUpdated = new EventEmitter<string>();
22+
public mde;
23+
readMDE: boolean = false;
2224

23-
constructor(private elementRef:ElementRef) {
24-
super();
25-
}
25+
constructor(private elementRef:ElementRef) {
26+
super();
27+
}
28+
29+
ngAfterViewInit(){
30+
var self = this;
31+
// Instantiate SimpleMDE
32+
this.mde = new SimpleMDE({ element: this.elementRef.nativeElement.value });
33+
// Read initial data from task markdown
34+
this.mde.value(self.mdData);
35+
// Catch changes
36+
this.mde.codemirror.on("change", function() {
37+
self.mdData = self.mde.value();
38+
self.mdUpdated.emit(self.mdData);
39+
});
40+
}
41+
ngOnChanges(changes) {
42+
// Only update editor on first defined value
43+
if(typeof this.mde !== "undefined" && !this.readMDE) {
44+
this.mde.value(changes['mdData'].currentValue);
45+
this.readMDE = true;
46+
}
47+
}
2648

27-
ngAfterViewInit(){
28-
var self = this;
29-
// Instantiate SimpleMDE
30-
var mde = new SimpleMDE({ element: this.elementRef.nativeElement.value });
31-
// Read initial data from task markdown
32-
mde.value(self.mdData);
33-
// Catch changes
34-
mde.codemirror.on("change", function() {
35-
self.mdData = mde.value();
36-
self.mdUpdated.emit(self.mdData);
37-
});
38-
}
3949
}

client/imports/ui/pages/account/account.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
// Meteor Imports
2-
import { Meteor } from 'meteor/meteor';
2+
import { Meteor } from 'meteor/meteor';
33

44
// Angular Imports
5-
import { Component, ViewEncapsulation, provide } from '@angular/core';
6-
import { ActivatedRoute } from '@angular/router';
7-
import { InjectUser } from 'angular2-meteor-accounts-ui';
5+
import { Component, ViewEncapsulation, provide } from '@angular/core';
6+
import { ActivatedRoute } from '@angular/router';
7+
import { InjectUser } from 'angular2-meteor-accounts-ui';
88

99
// Angular Material Imports
10-
import { MATERIAL_DIRECTIVES } from 'ng2-material';
11-
import { MeteorComponent } from 'angular2-meteor';
10+
import { MATERIAL_DIRECTIVES } from 'ng2-material';
11+
import { MeteorComponent } from 'angular2-meteor';
12+
13+
// Icons
14+
import { MD_ICON_DIRECTIVES } from '@angular2-material/icon';
1215

1316
// Define Account Component
1417
@Component({
1518
selector: 'tuxlab-account',
1619
templateUrl: '/client/imports/ui/pages/account/account.html',
1720
directives: [
18-
MATERIAL_DIRECTIVES
21+
MATERIAL_DIRECTIVES,
22+
MD_ICON_DIRECTIVES
1923
]
2024
})
2125

client/imports/ui/pages/course/course.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
import { MeteorComponent } from 'angular2-meteor';
1515
import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay';
1616

17-
// Icon
18-
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
19-
2017
// Roles
2118
import { Roles } from '../../../../../collections/users.ts';
2219

@@ -60,3 +57,4 @@
6057
}
6158
}
6259
}
60+

client/imports/ui/pages/course/course_dashboard.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{{ courseName }}
88
<md-icon fontIcon="tuxicon-cog" *ngIf="isInstruct()"></md-icon>
99
</span>
10-
10+
1111
</md-card-title-text>
1212
</md-card-title>
1313
<md-card-content>
@@ -19,7 +19,7 @@
1919
</md-card>
2020

2121
<!-- Responsive Section for Grades and Assignments -->
22-
<div layout="row" layout-xs="column" *ngIf="!isInstruct()">
22+
<div layout="row" layout-xs="column" *ngIf="!isInstruct()">
2323
<!-- Grade List -->
2424
<div flex>
2525
<tuxlab-gradelist></tuxlab-gradelist>
@@ -59,9 +59,9 @@
5959
</md-card>
6060
</div>
6161
</div>
62-
62+
6363
<!-- Permissions Section -->
64-
<div layout="row" *ngIf="isInstruct()">
64+
<div layout="row" *ngIf="isInstruct()" layout-xs="column">
6565
<div flex>
6666
<md-card>
6767
<md-card-title>
@@ -85,16 +85,19 @@
8585
</md-card-title-text>
8686
</md-card-title>
8787
<md-card-content>
88-
{{courseSyllabus}}
89-
<tuxlab-mdeditor [mdData]="courseSyllabus" (mdUpdated)="mdUpdate($event)"></tuxlab-mdeditor>
88+
<div *ngIf="editSyllabus">
89+
<tuxlab-mdeditor [mdData]="courseSyllabus" (mdUpdated)="mdUpdate($event)"></tuxlab-mdeditor>
90+
</div>
91+
<div *ngIf="!editSyllabus" [innerHTML]="convert(courseSyllabus)"></div>
9092
</md-card-content>
9193
<md-card-actions layout="row" layout-align="end center">
92-
<a md-button (click)="updateSyllabus()">Submit</a>
94+
<a md-button (click)="updateSyllabus()" *ngIf="editSyllabus">Submit</a>
95+
<a md-button *ngIf="!editSyllabus" (click)="toggleEdit()">Edit</a>
9396
</md-card-actions>
9497
</md-card>
9598
</div>
9699
</div>
97-
100+
98101
<!--Lab List Card-->
99102
<div>
100103
<tuxlab-lablist></tuxlab-lablist>

0 commit comments

Comments
 (0)