diff --git a/client/imports/ui/components/explore/explore.html b/client/imports/ui/components/explore/explore.html index df92a4e8..f1a3fe25 100644 --- a/client/imports/ui/components/explore/explore.html +++ b/client/imports/ui/components/explore/explore.html @@ -1,6 +1,6 @@
- + @@ -27,9 +27,7 @@

{{ course.course_number }} | {{ course.course_name }}

diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index 6e01a2e2..298bb154 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -1,34 +1,53 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; + import { Meteor } from 'meteor/meteor'; // Angular Imports - import { Component } from '@angular/core'; + import { Component } from '@angular/core'; + import { ROUTER_DIRECTIVES } from '@angular/router'; // Angular Material Imports - import { MATERIAL_DIRECTIVES } from 'ng2-material'; - import { MeteorComponent } from 'angular2-meteor'; + import { MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; + import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; -// Courses Imports - import { courses } from '../../../../../collections/courses.ts'; +// Collections + declare var Collections: any; + +/// + import * as marked from 'marked'; // Define ExploreView Component - @Component({ - selector: 'tuxlab-exploreview', - templateUrl: '/client/imports/ui/components/explore/explore.html', - directives: [ - MATERIAL_DIRECTIVES - ], - }) + @Component({ + selector: 'tuxlab-exploreview', + templateUrl: '/client/imports/ui/components/explore/explore.html', + directives: [ + MATERIAL_DIRECTIVES, + ROUTER_DIRECTIVES, + MD_TABS_DIRECTIVES + ], + }) // Export ExploreView Class export class ExploreView extends MeteorComponent { - courses: Array = []; - - constructor() { - super(); - - this.subscribe('explore-courses', () => { - this.courses = courses.find().fetch();}, true); - } + exploreCourses: Array = []; + + constructor() { + super(); + + this.subscribe('explore-courses', () => { + this.exploreCourses = Collections.courses.find({ "featured": true }).fetch(); + }, true); + } + + // Convert to markdown + convert(markdown: string) { + let md = marked.setOptions({}); + if(typeof markdown !== "undefined" && markdown !== null) { + return md.parse(markdown); + } + else { + return ""; + } + } } diff --git a/client/imports/ui/components/explore/search.ts b/client/imports/ui/components/explore/search.ts index b0987790..37d4811f 100644 --- a/client/imports/ui/components/explore/search.ts +++ b/client/imports/ui/components/explore/search.ts @@ -3,6 +3,7 @@ // Angular Imports import { Component, Input } from '@angular/core'; + import { ROUTER_DIRECTIVES } from '@angular/router'; // Angular Material Imports import { MeteorComponent } from 'angular2-meteor'; @@ -10,7 +11,10 @@ import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; // Courses Database Imports - import { courses } from '../../../../../collections/courses.ts'; + import { courses } from '../../../../../collections/courses.ts'; + +// Icons + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; // Define SearchView Component @Component({ @@ -18,7 +22,9 @@ templateUrl: '/client/imports/ui/components/explore/search.html', directives: [ MATERIAL_DIRECTIVES, - MD_TABS_DIRECTIVES + MD_TABS_DIRECTIVES, + MD_ICON_DIRECTIVES, + ROUTER_DIRECTIVES ] }) diff --git a/client/imports/ui/components/markdown/markdown.html b/client/imports/ui/components/markdown/markdown.html index 68029f29..8f1ef52e 100644 --- a/client/imports/ui/components/markdown/markdown.html +++ b/client/imports/ui/components/markdown/markdown.html @@ -7,11 +7,11 @@
- +
-

Task Feedback:

+

Task Feedback:

diff --git a/client/imports/ui/components/markdown/markdown.ts b/client/imports/ui/components/markdown/markdown.ts index 9ac0d646..ad7ce4eb 100644 --- a/client/imports/ui/components/markdown/markdown.ts +++ b/client/imports/ui/components/markdown/markdown.ts @@ -17,6 +17,9 @@ // Roles import { Roles } from '../../../../../collections/users.ts'; +// Icons + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; + declare var Collections: any; // Markdown Imports @@ -29,15 +32,17 @@ declare var Collections: any; templateUrl: '/client/imports/ui/components/markdown/markdown.html', directives: [ MATERIAL_DIRECTIVES, + MD_ICON_DIRECTIVES, MDEditor - ] + ], }) // Export MarkdownView Class export class MarkdownView extends MeteorComponent{ @Input() mdData = ""; @Input() mdDataUpdate = ""; - + @Input() taskid: number; + courseId: string; labId: string; showMDE: boolean = false; @@ -75,10 +80,11 @@ export class MarkdownView extends MeteorComponent{ // Update new markdown updateMarkdown() { Collections.labs.update({ - _id: this.labId + _id: this.labId, + "tasks.id": this.taskid }, { $set: { - // Set current task markdown + "tasks.$.md": this.mdData } }); } diff --git a/client/imports/ui/components/mdeditor/mdeditor.ts b/client/imports/ui/components/mdeditor/mdeditor.ts index 84fe4e68..8c17ffe6 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.ts +++ b/client/imports/ui/components/mdeditor/mdeditor.ts @@ -1,39 +1,49 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; - import { MeteorComponent } from 'angular2-meteor'; + import { Meteor } from 'meteor/meteor'; + import { MeteorComponent } from 'angular2-meteor'; // Angular Imports - import { Component, ElementRef, ViewChild, Input, Output, EventEmitter } from '@angular/core'; + import { Component, ElementRef, ViewChild, Input, Output, EventEmitter, OnChanges } from '@angular/core'; // Declare Global Variable - var SimpleMDE : any = require('simplemde'); + var SimpleMDE : any = require('simplemde'); // Define Editor Component - @Component({ - selector: 'tuxlab-mdeditor', - templateUrl: '/client/imports/ui/components/mdeditor/mdeditor.html', - }) + @Component({ + selector: 'tuxlab-mdeditor', + templateUrl: '/client/imports/ui/components/mdeditor/mdeditor.html', + }) // Export Editor Class - export class MDEditor extends MeteorComponent { - @ViewChild('simplemde') textarea : ElementRef; - @Input() mdData: string = ""; - @Output() mdUpdated = new EventEmitter(); + export class MDEditor extends MeteorComponent implements OnChanges { + @ViewChild('simplemde') textarea : ElementRef; + @Input() mdData: string = ""; + @Output() mdUpdated = new EventEmitter(); + public mde; + readMDE: boolean = false; - constructor(private elementRef:ElementRef) { - super(); - } + constructor(private elementRef:ElementRef) { + super(); + } + + ngAfterViewInit(){ + var self = this; + // Instantiate SimpleMDE + this.mde = new SimpleMDE({ element: this.elementRef.nativeElement.value }); + // Read initial data from task markdown + this.mde.value(self.mdData); + // Catch changes + this.mde.codemirror.on("change", function() { + self.mdData = self.mde.value(); + self.mdUpdated.emit(self.mdData); + }); + } + ngOnChanges(changes) { + // Only update editor on first defined value + if(typeof this.mde !== "undefined" && !this.readMDE) { + this.mde.value(changes['mdData'].currentValue); + this.readMDE = true; + } + } - ngAfterViewInit(){ - var self = this; - // Instantiate SimpleMDE - var mde = new SimpleMDE({ element: this.elementRef.nativeElement.value }); - // Read initial data from task markdown - mde.value(self.mdData); - // Catch changes - mde.codemirror.on("change", function() { - self.mdData = mde.value(); - self.mdUpdated.emit(self.mdData); - }); - } } diff --git a/client/imports/ui/pages/account/account.ts b/client/imports/ui/pages/account/account.ts index 1132555a..65dec7b7 100644 --- a/client/imports/ui/pages/account/account.ts +++ b/client/imports/ui/pages/account/account.ts @@ -1,21 +1,25 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; + import { Meteor } from 'meteor/meteor'; // Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; - import { ActivatedRoute } from '@angular/router'; - import { InjectUser } from 'angular2-meteor-accounts-ui'; + import { Component, ViewEncapsulation, provide } from '@angular/core'; + import { ActivatedRoute } from '@angular/router'; + import { InjectUser } from 'angular2-meteor-accounts-ui'; // Angular Material Imports - import { MATERIAL_DIRECTIVES } from 'ng2-material'; - import { MeteorComponent } from 'angular2-meteor'; + import { MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; + +// Icons + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; // Define Account Component @Component({ selector: 'tuxlab-account', templateUrl: '/client/imports/ui/pages/account/account.html', directives: [ - MATERIAL_DIRECTIVES + MATERIAL_DIRECTIVES, + MD_ICON_DIRECTIVES ] }) diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index 195c3a7e..1ae23984 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -14,9 +14,6 @@ import { MeteorComponent } from 'angular2-meteor'; import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay'; -// Icon - import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; - // Roles import { Roles } from '../../../../../collections/users.ts'; @@ -60,3 +57,4 @@ } } } + diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 23deea4f..f0138705 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -7,7 +7,7 @@ {{ courseName }} - + @@ -19,7 +19,7 @@ -
+
@@ -59,9 +59,9 @@
- + -
+
@@ -85,16 +85,19 @@ - {{courseSyllabus}} - +
+ +
+
- Submit + Submit + Edit
- +
diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index bec850a6..d07eb938 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -15,15 +15,21 @@ // LabList and Grades import import { GradeList } from './gradelist.ts'; import { LabList } from './lablist.ts'; - + // Roles Import import { Roles } from '../../../../../collections/users.ts'; // Markdown Editor import { MDEditor } from '../../components/mdeditor/mdeditor.ts'; + +// Icon + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; declare var Collections: any; +/// + import * as marked from 'marked'; + // Define CourseDashboard Component @Component({ selector: 'tuxlab-course-dashboard', @@ -32,6 +38,7 @@ declare var Collections: any; ROUTER_DIRECTIVES, MATERIAL_DIRECTIVES, MD_INPUT_DIRECTIVES, + MD_ICON_DIRECTIVES, LabList, MDEditor, GradeList @@ -46,6 +53,7 @@ declare var Collections: any; courseDescription: string = ""; courseName: string = ""; courseSyllabus: string = ""; + editSyllabus: boolean = false; constructor(private route: ActivatedRoute, private router: Router) { super(); @@ -71,16 +79,37 @@ declare var Collections: any; return false; } } + + // Emit function mdUpdate(md: string) { this.courseSyllabus = md; } + + // Update the database with new syllabus updateSyllabus() { - Collections.courses.update({ - _id: this.courseId + Collections.courses.update({ + _id: this.courseId }, { $set: { "course_description.syllabus": this.courseSyllabus } }); + this.toggleEdit(); + } + + // Hide and show the markdown editor for syllabus + toggleEdit() { + this.editSyllabus = !this.editSyllabus; + } + + // Convert to markdown + convert(markdown: string) { + let md = marked.setOptions({}); + if(typeof markdown !== "undefined" && markdown !== null) { + return md.parse(markdown); + } + else { + return ""; + } } } diff --git a/client/imports/ui/pages/explore/explore.ts b/client/imports/ui/pages/explore/explore.ts index 843de3a0..583a08b7 100644 --- a/client/imports/ui/pages/explore/explore.ts +++ b/client/imports/ui/pages/explore/explore.ts @@ -1,24 +1,27 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; + import { Meteor } from 'meteor/meteor'; // Angular Imports - import { Component, Input } from '@angular/core'; - import { InjectUser } from 'angular2-meteor-accounts-ui'; - import { ROUTER_DIRECTIVES } from '@angular/router' + import { Component, Input } from '@angular/core'; + import { InjectUser } from 'angular2-meteor-accounts-ui'; + import { ROUTER_DIRECTIVES } from '@angular/router' // Angular Material Imports - import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; - import { MeteorComponent } from 'angular2-meteor'; + import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; - import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; - import { MD_INPUT_DIRECTIVES } from '@angular2-material/input'; - import { MdToolbar } from '@angular2-material/toolbar'; - import { FORM_DIRECTIVES, FORM_PROVIDERS } from '@angular/forms'; + import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; + import { MD_INPUT_DIRECTIVES } from '@angular2-material/input'; + import { MdToolbar } from '@angular2-material/toolbar'; + import { FORM_DIRECTIVES, FORM_PROVIDERS } from '@angular/forms'; // Component View Imports - import { ExploreView } from '../../components/explore/explore.ts'; - import { SearchView } from '../../components/explore/search.ts'; + import { ExploreView } from '../../components/explore/explore.ts'; + import { SearchView } from '../../components/explore/search.ts'; + +// Icons + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; // Define Explore Component @Component({ @@ -26,10 +29,11 @@ templateUrl: '/client/imports/ui/pages/explore/explore.html', directives: [ MATERIAL_DIRECTIVES, - ROUTER_DIRECTIVES, + ROUTER_DIRECTIVES, MD_TABS_DIRECTIVES, MD_INPUT_DIRECTIVES, FORM_DIRECTIVES, + MD_ICON_DIRECTIVES, MdToolbar, ExploreView, SearchView diff --git a/client/imports/ui/pages/lab/labview.html b/client/imports/ui/pages/lab/labview.html index 06037825..9a8a785c 100644 --- a/client/imports/ui/pages/lab/labview.html +++ b/client/imports/ui/pages/lab/labview.html @@ -5,25 +5,23 @@ - Course Page - LabVM Connection - + + + - LabVM Connection You are currently connected. -
diff --git a/client/imports/ui/pages/lab/labview.ts b/client/imports/ui/pages/lab/labview.ts index aad5f7fd..13a116ce 100644 --- a/client/imports/ui/pages/lab/labview.ts +++ b/client/imports/ui/pages/lab/labview.ts @@ -18,6 +18,9 @@ // Terminal and Markdown Imports import { Terminal } from "../../components/wetty/terminal.ts"; import { MarkdownView } from "../../components/markdown/markdown.ts"; + +// Icons + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; // Meteor method imports import "../../../lab/methods.ts" @@ -31,6 +34,7 @@ Terminal, MATERIAL_DIRECTIVES, MD_INPUT_DIRECTIVES, + MD_ICON_DIRECTIVES, MD_SIDENAV_DIRECTIVES, MD_TOOLBAR_DIRECTIVES, ROUTER_DIRECTIVES diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index b00c7066..03756919 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -59,13 +59,10 @@ md-sidenav { width: 260px; padding: 0; - a { - color: black; - display: block; + button { width: 260px; height: 50px; margin: 0; - line-height: 50px; text-align: left; padding-left: 15px; padding-right: 15px; @@ -74,7 +71,7 @@ color: #64dd17; } .tuxicon-tick:before { - font-size: 36px + font-size: 36px; } .tuxicon-progress:before { font-size: 36px; diff --git a/public/assets b/public/assets index bac57f8b..a977e98c 160000 --- a/public/assets +++ b/public/assets @@ -1 +1 @@ -Subproject commit bac57f8b0ed7c81e45d1dcad51ecb193bfc2885e +Subproject commit a977e98c22fef515cd14c0f49b5ee89601dda398 diff --git a/server/imports/course/search.ts b/server/imports/course/search.ts index 266d2b61..fd0b28ef 100644 --- a/server/imports/course/search.ts +++ b/server/imports/course/search.ts @@ -15,6 +15,7 @@ export function course_search(text : string, results_per_page : number, page_no var search_object = {$and : [ {"hidden" : false}, + { "permissions.meta": true }, {$or : [ {"course_number" : search_pattern}, {$where: "this.course_number.replace(/[ .-]/g,'') == '"+text+"'"}, diff --git a/tsconfig.json b/tsconfig.json index c839a68b..ef0803c5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true }, - "compileOnSave": true, + "compileOnSave": false, "filesGlob": [ "client/**/*.ts", "server/**/*.ts", @@ -57,6 +57,7 @@ "server/imports/course/search.ts", "server/imports/lab/checkLab.d.ts", "server/imports/lab/labMethods.ts", + "server/imports/lab/markdown.ts", "server/imports/lab/methods.ts", "typings/globals/es6-shim/index.d.ts", "typings/globals/meteor/index.d.ts",