From b73fb9d60c462ca7e39a0489b9a30ad64ad4b447 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Wed, 6 Jul 2016 17:18:42 -0400 Subject: [PATCH 001/102] Updated Schemas --- client/imports/ui/pages/account/account.ts | 52 +++++++++++----------- collections/courses.ts | 3 ++ collections/users.ts | 3 ++ 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/client/imports/ui/pages/account/account.ts b/client/imports/ui/pages/account/account.ts index ca6cadca..274aae37 100644 --- a/client/imports/ui/pages/account/account.ts +++ b/client/imports/ui/pages/account/account.ts @@ -12,44 +12,42 @@ import { HTTP_PROVIDERS } from '@angular/http'; import { RouterLink, ROUTER_PROVIDERS, ROUTER_DIRECTIVES, RouteConfig } from '@angular/router-deprecated'; - import { InjectUser, RequireUser } from 'angular2-meteor-accounts-ui'; + import { InjectUser } from 'angular2-meteor-accounts-ui'; // Angular Material Imports import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; import { MeteorComponent } from 'angular2-meteor'; + import { MD_SIDENAV_DIRECTIVES } from '@angular2-material/sidenav'; + +// Toolbar + import { MD_TOOLBAR_DIRECTIVES } from '@angular2-material/toolbar'; // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon' - -// Define TuxLab Component - @Component({ +// Define Account Component +@Component({ selector: 'tuxlab-account', templateUrl: '/client/imports/ui/pages/account/account.html', - directives: [ MD_ICON_DIRECTIVES, - MATERIAL_DIRECTIVES ], + directives: [ MATERIAL_DIRECTIVES, + MD_TOOLBAR_DIRECTIVES, + MD_ICON_DIRECTIVES ], viewProviders: [ MdIconRegistry ], encapsulation: ViewEncapsulation.None - }) - +}) + @InjectUser("user") export class Account extends MeteorComponent { - user: Meteor.User; - name: String = "Name Here"; - school: String = "School Here"; - email: String = "example@example.com"; - imgsrc: String = "http://www.placekitten.com/g/250/250"; - constructor(mdIconRegistry: MdIconRegistry) { - super(); - // Create Icon Font - mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); - mdIconRegistry.setDefaultFontSetClass('tuxicon'); - - } - test() { - this.name = this.user.profile.name; - this.school = "Carnegie Mellon University"; - this.imgsrc = this.user.profile.picture; - this.email = this.user.profile.email; - } -} + user: Meteor.User; + imgsrc: String = "http://www.placekitten.com/g/250/250"; + name: String = "Name Here"; + school: String = "School Name Here"; + email: String = "example@example.com"; + constructor(mdIconRegistry: MdIconRegistry) { + super(); + // Create Icon Font + mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); + mdIconRegistry.setDefaultFontSetClass('tuxicon'); + + } +} diff --git a/collections/courses.ts b/collections/courses.ts index effab4c9..4be78795 100644 --- a/collections/courses.ts +++ b/collections/courses.ts @@ -63,6 +63,9 @@ if (Meteor.isServer){ }, labs: { type: [labSchema] + }, + instructor_name: { + type: String } }); (courses).attachSchema(courseSchema); diff --git a/collections/users.ts b/collections/users.ts index 78e7da50..bd28bd78 100644 --- a/collections/users.ts +++ b/collections/users.ts @@ -15,6 +15,9 @@ if (Meteor.isServer){ last_name: { type: String }, + school: { + type: String + }, email: { type: String }, From 0effec138a87a69216c1fd09005026cb071ca9a2 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Wed, 6 Jul 2016 17:30:32 -0400 Subject: [PATCH 002/102] Load Screen --- .../ui/components/loadscreen/loadscreen.html | 10 ++++ .../ui/components/loadscreen/loadscreen.ts | 46 +++++++++++++++++++ .../ui/components/markdown/markdown.ts | 1 - .../ui/pages/instructor/instructor.html | 1 + .../imports/ui/pages/instructor/instructor.ts | 6 ++- 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 client/imports/ui/components/loadscreen/loadscreen.html create mode 100644 client/imports/ui/components/loadscreen/loadscreen.ts diff --git a/client/imports/ui/components/loadscreen/loadscreen.html b/client/imports/ui/components/loadscreen/loadscreen.html new file mode 100644 index 00000000..158d78fb --- /dev/null +++ b/client/imports/ui/components/loadscreen/loadscreen.html @@ -0,0 +1,10 @@ +
+ + This is an alert title + You can specify some description text in here + + + +
\ No newline at end of file diff --git a/client/imports/ui/components/loadscreen/loadscreen.ts b/client/imports/ui/components/loadscreen/loadscreen.ts new file mode 100644 index 00000000..48ba17ab --- /dev/null +++ b/client/imports/ui/components/loadscreen/loadscreen.ts @@ -0,0 +1,46 @@ +// Meteor Imports + import { Meteor } from 'meteor/meteor'; + import { Mongo } from 'meteor/mongo'; + import 'reflect-metadata'; + import 'zone.js/dist/zone'; + +// Angular Imports + import { Component, ViewEncapsulation, provide } from '@angular/core'; + import { bootstrap } from 'angular2-meteor-auto-bootstrap'; + import { APP_BASE_HREF } from '@angular/common'; + import { HTTP_PROVIDERS } from '@angular/http'; + import { InjectUser } from 'angular2-meteor-accounts-ui'; + +// Angular Material Imports + import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; + import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay'; + +// Toolbar + import { MD_TOOLBAR_DIRECTIVES } from '@angular2-material/toolbar'; + +// Icon + import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; + +// Define LoadScreen Component + @Component({ + selector: 'tuxlab-loadscreen', + templateUrl: '/client/imports/ui/components/loadscreen/loadscreen.html', + directives: [ MATERIAL_DIRECTIVES, + MD_TOOLBAR_DIRECTIVES, + MD_ICON_DIRECTIVES ], + viewProviders: [ MdIconRegistry ], + providers: [ OVERLAY_PROVIDERS ], + encapsulation: ViewEncapsulation.None + }) + +// Export LoadScreen Class +export class LoadScreen extends MeteorComponent { + constructor(mdIconRegistry: MdIconRegistry) { + super(); + // Create Icon Font + mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); + mdIconRegistry.setDefaultFontSetClass('tuxicon'); + + } +} diff --git a/client/imports/ui/components/markdown/markdown.ts b/client/imports/ui/components/markdown/markdown.ts index 82be3b41..d3d62526 100644 --- a/client/imports/ui/components/markdown/markdown.ts +++ b/client/imports/ui/components/markdown/markdown.ts @@ -18,7 +18,6 @@ // Toolbar import { MD_TOOLBAR_DIRECTIVES } from '@angular2-material/toolbar'; - import "../../../../../node_modules/@angular2-material/toolbar/toolbar.css"; // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; diff --git a/client/imports/ui/pages/instructor/instructor.html b/client/imports/ui/pages/instructor/instructor.html index 4502e313..2caf1718 100644 --- a/client/imports/ui/pages/instructor/instructor.html +++ b/client/imports/ui/pages/instructor/instructor.html @@ -10,4 +10,5 @@ + \ No newline at end of file diff --git a/client/imports/ui/pages/instructor/instructor.ts b/client/imports/ui/pages/instructor/instructor.ts index 4e74a510..2919bf8d 100644 --- a/client/imports/ui/pages/instructor/instructor.ts +++ b/client/imports/ui/pages/instructor/instructor.ts @@ -21,6 +21,8 @@ // Editor Component import { MDEditor } from '../../components/mdeditor/mdeditor'; + + import { LoadScreen } from '../../components/loadscreen/loadscreen'; // Define InstructorView Component @Component({ @@ -30,7 +32,8 @@ MATERIAL_DIRECTIVES, MD_ICON_DIRECTIVES, MD_SIDENAV_DIRECTIVES, - MDEditor + MDEditor, + LoadScreen ], viewProviders: [ MdIconRegistry ], encapsulation: ViewEncapsulation.None @@ -45,7 +48,6 @@ export class Instructor extends MeteorComponent { // Create Icon Font mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); - } } From 78426b80d4dc702a618692a2fd2e9d8e065d3f4a Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Wed, 6 Jul 2016 17:35:20 -0400 Subject: [PATCH 003/102] Loading Screen --- client/imports/ui/components/loadscreen/loadscreen.html | 3 --- client/imports/ui/components/loadscreen/loadscreen.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/client/imports/ui/components/loadscreen/loadscreen.html b/client/imports/ui/components/loadscreen/loadscreen.html index 158d78fb..fdf5b002 100644 --- a/client/imports/ui/components/loadscreen/loadscreen.html +++ b/client/imports/ui/components/loadscreen/loadscreen.html @@ -4,7 +4,4 @@ You can specify some description text in here - \ No newline at end of file diff --git a/client/imports/ui/components/loadscreen/loadscreen.ts b/client/imports/ui/components/loadscreen/loadscreen.ts index 48ba17ab..6624bb3c 100644 --- a/client/imports/ui/components/loadscreen/loadscreen.ts +++ b/client/imports/ui/components/loadscreen/loadscreen.ts @@ -41,6 +41,6 @@ export class LoadScreen extends MeteorComponent { // Create Icon Font mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); - + } } From 658bd9f6803fa8d09e0b1d1207676623fb8765bd Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 7 Jul 2016 14:53:51 -0400 Subject: [PATCH 004/102] publish subscribe and dynamic explore page --- .../ui/components/explore/explore.html | 18 +-- .../imports/ui/components/explore/explore.ts | 58 +++------ .../imports/ui/components/explore/search.html | 8 +- .../imports/ui/components/explore/search.ts | 40 +++--- .../imports/ui/components/lablist/lablist.ts | 94 +++++++------- collections/course_records.ts | 19 ++- collections/courses.ts | 10 ++ tests/example_data/example_course.js | 116 ++++++++++++++++++ 8 files changed, 236 insertions(+), 127 deletions(-) diff --git a/client/imports/ui/components/explore/explore.html b/client/imports/ui/components/explore/explore.html index b99ef8b3..b4028e99 100644 --- a/client/imports/ui/components/explore/explore.html +++ b/client/imports/ui/components/explore/explore.html @@ -6,37 +6,37 @@ - + - + - \ No newline at end of file + diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index efb9181c..cb47a2c1 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -21,15 +21,20 @@ // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; +// Courses Imports + import { courses } from "../../../../../collections/courses.ts"; + // Define ExploreView Component @Component({ selector: 'tuxlab-exploreview', templateUrl: '/client/imports/ui/components/explore/explore.html', - directives: [ MATERIAL_DIRECTIVES, - MD_ICON_DIRECTIVES, - MD_TABS_DIRECTIVES, - MD_INPUT_DIRECTIVES, - MdToolbar ], + directives: [ + MATERIAL_DIRECTIVES, + MD_ICON_DIRECTIVES, + MD_TABS_DIRECTIVES, + MD_INPUT_DIRECTIVES, + MdToolbar + ], viewProviders: [ MdIconRegistry ], encapsulation: ViewEncapsulation.None }) @@ -37,45 +42,20 @@ // Export ExploreView Class export class ExploreView extends MeteorComponent { - courses: Array = [ - { - 'id': '1', - 'courseName': 'Great Practical Ideas for Computer Scientists', - 'description': ` - Throughout your education as a Computer Scientist at - Carnegie Mellon, you will take courses on programming, - theoretical ideas, logic, systems, etc. As you progress, - you will be expected to pick up the so-called “tools of - the trade.” This course is intended to help you learn - what you need to know in a friendly, low-stress, - high-support way. We will discuss UNIX, LaTeX, debugging - and many other essential tools. - `, - 'syllabus': 'This is supposed to be the syllabus.', - 'content': 'This is the course content of GPI.' - }, - { - 'id': '2', - 'courseName': 'Great Theoretical Ideas in Computer Science', - 'description': 'This course will blow your mind', - 'syllabus': 'Fail to be amazing and you will fail the course.', - 'content': 'This is the course content of GTI.' - }, - { - 'id': '3', - 'courseName': 'Principles of Functional Programming', - 'description': 'This course will teach you how to program functionally.', - 'syllabus': 'You will scrape by with a course average of 90%.', - 'content': 'We will be using SML.' - } - ]; - + courses: Array = []; + constructor(mdIconRegistry: MdIconRegistry) { super(); // Create Icon Font mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); + + this.getCourses(); } - + getCourses() { + this.subscribe('courses', () => { + this.courses = courses.find().fetch(); + }, true); + } } diff --git a/client/imports/ui/components/explore/search.html b/client/imports/ui/components/explore/search.html index 9503e62b..57747fb8 100644 --- a/client/imports/ui/components/explore/search.html +++ b/client/imports/ui/components/explore/search.html @@ -18,14 +18,14 @@

Search Results

Course Number Course Name - Seats Left + Instructor - {{ course.number }} - {{ course.name }} - {{ course.quantity }} + {{ course.course_number }} + {{ course.course_name }} + {{ course.instructor_name }} diff --git a/client/imports/ui/components/explore/search.ts b/client/imports/ui/components/explore/search.ts index 6834f5b5..878366c7 100644 --- a/client/imports/ui/components/explore/search.ts +++ b/client/imports/ui/components/explore/search.ts @@ -21,6 +21,9 @@ // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; +// Courses Database Imports + import { courses } from '../../../../../collections/courses'; + // Define SearchView Component @Component({ selector: 'tuxlab-searchview', @@ -37,30 +40,14 @@ // Export Explore Class export class SearchView extends MeteorComponent { - courses: Array = [ - {'id': 1, 'number': '15-131', 'name': 'Great Practical Ideas for Computer Scientists', 'quantity': '12'}, - {'id': 2, 'number': '15-251', 'name': 'Great Theoretical Ideas in Computer Science', 'quantity': '12'}, - {'id': 3, 'number': '15-122', 'name': 'Principles of Imperative Computation', 'quantity': '23'}, - {'id': 4, 'number': '15-112', 'name': 'Principles of Programming', 'quantity': '11'}, - {'id': 5, 'number': '15-150', 'name': 'Principles of Functional Programming', 'quantity': '14'}, - {'id': 6, 'number': '21-127', 'name': 'Concepts of Mathematics', 'quantity': '54'}, - {'id': 7, 'number': '21-299', 'name': 'Calculus in Twelve Dimensions', 'quantity': '76'}, - {'id': 8, 'number': '79-104', 'name': 'Global Histories', 'quantity': '56'}, - {'id': 9, 'number': '15-999', 'name': 'Introduction to Linux', 'quantity': '44'}, - {'id': 10, 'number': '15-998', 'name': 'Vim Usage', 'quantity': '1'}, - {'id': 11, 'number': '15-000', 'name': 'Emacs Usage', 'quantity': '2'}, - {'id': 12, 'number': '15-997', 'name': 'Bash Commands', 'quantity': '3'}, - {'id': 13, 'number': '21-241', 'name': 'Matrices and Linear Transformations', 'quantity': '4'}, - {'id': 14, 'number': '21-341', 'name': 'Matrix Theory', 'quantity': '5'}, - {'id': 15, 'number': '36-225', 'name': 'Probability Theory', 'quantity': '6'} - ]; + courses: Array = []; pagination = { currentPage: 1, - itemsPerPage: 5, + itemsPerPage: 10, totalItems: this.courses.length }; ipp: Array = [5, 10, 15]; - selectedPage = 5; + selectedPage = 10; pagedCourses: Array = []; constructor(mdIconRegistry: MdIconRegistry) { @@ -70,11 +57,18 @@ export class SearchView extends MeteorComponent { // Create Icon Font mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); - - // Refresh Courses List on load - this.refreshCourses(); - + + // Subscribe Courses Database + this.getCourses(); } + + getCourses() { + this.subscribe('courses', () => { + this.courses = courses.find().fetch(); + this.pagination.totalItems = this.courses.length; + this.refreshCourses(); + }, true); + } // Refresh Courses List refreshCourses() { diff --git a/client/imports/ui/components/lablist/lablist.ts b/client/imports/ui/components/lablist/lablist.ts index 3a9581fd..f8f8f380 100644 --- a/client/imports/ui/components/lablist/lablist.ts +++ b/client/imports/ui/components/lablist/lablist.ts @@ -36,55 +36,55 @@ }) // Export LabList Class - export class LabList extends MeteorComponent { - user: Meteor.User; - courseId: String; // TODO: Get from URL - userId: String = '1'; // TODO: Get from Meteor.userId - labs: Array = []; - courseRecord; - - // Progress Bar Value - public determinateValue: number = 30; - - constructor(mdIconRegistry: MdIconRegistry) { - super(); - // Create Icon Font - mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); - mdIconRegistry.setDefaultFontSetClass('tuxicon'); - - this.setLab(this.courseId, this.userId); - } + export class LabList extends MeteorComponent { + user: Meteor.User; + courseId: String; // TODO: Get from URL + userId: String = '1'; // TODO: Get from Meteor.userId + labs: Array = []; + courseRecord; + + // Progress Bar Value + public determinateValue: number = 30; + + constructor(mdIconRegistry: MdIconRegistry) { + super(); + // Create Icon Font + mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); + mdIconRegistry.setDefaultFontSetClass('tuxicon'); + + this.setLab(this.courseId, this.userId); + } // Method to subscribe to course_records database and set Lab data - setLab(courseId: String, userId: String) { - this.subscribe('course-records', [courseId, userId], () => { - this.courseRecord = course_records.findOne({ user_id: userId }); //TODO: add course_id - if(this.courseRecord !== undefined) { - let labs = this.courseRecord.labs; - let totalCompleted = 0; - let totalNumTasks = 0; - for (let i = 0; i < labs.length; i++) { - let lab = labs[i]; - let tasksCompleted = 0; - let tasks = lab.tasks; - for (let j = 0; j < tasks.length; j++) { - let task = tasks[j]; - if (task.status === 'SUCCESS') { - tasksCompleted++; - } - } - this.labs.push({ - 'name': 'Lab ' + (i + 1).toString(), - 'completed': tasksCompleted.toString() + '/' + tasks.length.toString(), - 'date': lab.data.due_date - }); - totalCompleted += tasksCompleted; - totalNumTasks += tasks.length; - } - this.determinateValue = (totalCompleted * 100.0) / totalNumTasks; - } - }, true); - } + setLab(courseId: String, userId: String) { + this.subscribe('course-records', [courseId, userId], () => { + this.courseRecord = course_records.findOne({ user_id: userId }); //TODO: add course_id + if(this.courseRecord !== undefined) { + let labs = this.courseRecord.labs; + let totalCompleted = 0; + let totalNumTasks = 0; + for (let i = 0; i < labs.length; i++) { + let lab = labs[i]; + let tasksCompleted = 0; + let tasks = lab.tasks; + for (let j = 0; j < tasks.length; j++) { + let task = tasks[j]; + if (task.status === 'SUCCESS') { + tasksCompleted++; + } + } + this.labs.push({ + 'name': 'Lab ' + (i + 1).toString(), + 'completed': tasksCompleted.toString() + '/' + tasks.length.toString(), + 'date': lab.data.due_date + }); + totalCompleted += tasksCompleted; + totalNumTasks += tasks.length; + } + this.determinateValue = (totalCompleted * 100.0) / totalNumTasks; + } + }, true); + } // Link to lab function toLab(lab) { diff --git a/collections/course_records.ts b/collections/course_records.ts index 590454e6..8f5223ed 100644 --- a/collections/course_records.ts +++ b/collections/course_records.ts @@ -1,8 +1,7 @@ +import { Mongo } from 'meteor/mongo'; +import { Meteor } from 'meteor/meteor'; -import {Mongo} from 'meteor/mongo'; -import {Meteor} from 'meteor/meteor'; - -import {Roles} from './users.ts'; +import { Roles } from './users.ts'; export const course_records = new Mongo.Collection('course_records'); @@ -34,9 +33,19 @@ course_records.allow({ /* Schema */ declare var SimpleSchema: any; + if(Meteor.isServer) { Meteor.publish('course-records', function() { - return course_records.find(); + const options = { + + }; + const user = Meteor.users.findOne(this.userId); + if(user) { + return course_records.find({ user_id: this.userId }, options); + } + else { + return null; + } }); Meteor.startup(function() { var taskSchema = new SimpleSchema({ diff --git a/collections/courses.ts b/collections/courses.ts index 59ad79ba..25dad368 100644 --- a/collections/courses.ts +++ b/collections/courses.ts @@ -5,6 +5,8 @@ import { Roles } from './users.ts'; export const courses = new Mongo.Collection('courses'); +const MAX_COURSES = 4; + /** AUTHENTICATION **/ @@ -24,6 +26,14 @@ courses.allow({ declare var SimpleSchema: any; if (Meteor.isServer){ + Meteor.publish('courses', function() { + console.log(this.userId); + const options = { + sort: { course_number: 1 }, + limit: MAX_COURSES + }; + return courses.find({}, options); + }); Meteor.startup(function(){ var courseSchema = new SimpleSchema({ course_name: { diff --git a/tests/example_data/example_course.js b/tests/example_data/example_course.js index 1f8cb9cc..c3f0326f 100644 --- a/tests/example_data/example_course.js +++ b/tests/example_data/example_course.js @@ -8,6 +8,14 @@ var course_labfile = require('fs').readFileSync('./tests/example_data/example_la var course_obj = { course_number: "15-131", course_name: "Great Practical Ideas for Computer Scientists", + course_description: ` + Throughout your education as a Computer Scientist at Carnegie Mellon, + you will take courses on programming, theoretical ideas, logic, systems, etc. + As you progress, you will be expected to pick up the so-called “tools of the + trade.” This course is intended to help you learn what you need to know in a + friendly, low-stress, high-support way. We will discuss UNIX, LaTeX, + debugging and many other essential tools. + `, instructor_name: "Tom Cortina", file: course_labfile, labs: [ @@ -27,3 +35,111 @@ var course_obj = { } module.exports = course_obj; + + +// More Sample Data +/* +var myCourse1 = { + course_number: '15-122', + course_name: 'Principles of Imperative Programming', + course_description: ` + This course teaches imperative programming and methods for ensuring the correctness + of programs. It is intended for students with a basic understanding of programming + (variables, expressions, loops, arrays, functions). Students will learn the process + and concepts needed to go from high-level descriptions of algorithms to correct + imperative implementations, with specific applications to basic data structures + and algorithms. Much of the course will be conducted in a subset of C amenable + to verification, with a transition to full C near the end. + `, + instructor_name: 'Tom Cortina', + labs: [ + '574467bc11091623418a429d', + '574467bc110as623418a429d', + '574467bc11fab623418a429d' + ] +}; + +var myCourse2 = { + course_number: '15-131', + course_name: 'Great Practical Ideas for Computer Scientists', + course_description: ` + Throughout your education as a Computer Scientist at Carnegie Mellon, you will + take courses on programming, theoretical ideas, logic, systems, etc. As you progress, + you will be expected to pick up the so-called “tools of the trade.” This course is + intended to help you learn what you need to know in a friendly, low-stress, high-support + way. We will discuss UNIX, LaTeX, debugging and many other essential tools. + `, + instructor_name: 'Derek Brown', + labs: [ + '574467bc11091623418a429d', + '574467bc110as623418a429d', + '574467bc11fab623418a429d' + ] +}; + +var myCourse3 = { + course_number: '15-150', + course_name: 'Principles of Functional Programming', + course_description: ` + The purpose of this course is to introduce the theory and practice of functional + programming (FP). The characteristic feature of FP is the emphasis on computation + as evaluation. The traditional distinction between program and data characteristic of + imperative programming (IP) is replaced by an emphasis on classifying expressions by + types that specify their applicative behavior. Types include familiar (fixed and arbitrary + precision) numeric types, tuples and records (structs), classified values (objects), + inductive types such as trees, functions with specified inputs and outputs, and commands + such as input and output. Well-typed expressions are evaluated to produce values, + in a manner that is guaranteed to be type-safe. Because functional programs do not cause + side-effects we can take advantage of simple mathematical principles in reasoning about + applicative behavior and analyzing the runtime properties of programs. + `, + instructor_name: 'Michael Erdman', + labs: [ + '574467bc11091623418a429d', + '574467bc110as623418a429d', + '574467bc11fab623418a429d' + ] +}; + +var myCourse4 = { + course_number: '15-251', + course_name: 'Great Theoretical Ideas in Computer Science', + course_description: ` + Welcome to 15-251! This course will take a philosophical and historical perspective on + the development of theoretical computer science. From using a pile of stones to represent + and manipulate numbers, humans have progressively developed an abstract vocabulary with + which to mathematically represent their world. The ancients, especially the Greeks, + realized that they could consistently reason about their representations in a step-by-step + manner. In other words, by computing in abstract models, they could describe and + predict patterns in the world around them. + `, + instructor_name: 'Bernhard Haeupler', + labs: [ + '574467bc11091623418a429d', + '574467bc110as623418a429d', + '574467bc11fab623418a429d' + ] +}; + +var myCourse5 = { + course_number: '15-322', + course_name: 'Introduction to Computer Music', + course_description: ` + Computers are used to synthesize sound, process signals, and compose music. Personal + computers have replaced studios full of sound recording and processing equipment, + completing a revolution that began with recording and electronics. In this + course, students will learn the fundamentals of digital audio, basic sound + synthesis algorithms, and techniques for digital audio effects and processing. + Students will apply their knowledge in programming assignments using a very high-level + programming language for sound synthesis and composition. In a final project, + students will demonstrate their mastery of tools and techniques through a publicly + performed music composition. + `, + instructor_name: 'Jesse Styles', + labs: [ + '574467bc11091623418a429d', + '574467bc110as623418a429d', + '574467bc11fab623418a429d' + ] +}; +*/ From 5e1fd854ff51ba8d9446cd327b56b2f213216ad5 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 7 Jul 2016 17:24:20 -0400 Subject: [PATCH 005/102] deleted swap file --- collections/.courses.ts.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 collections/.courses.ts.swp diff --git a/collections/.courses.ts.swp b/collections/.courses.ts.swp deleted file mode 100644 index 739c884e550987078f257964cc6080b5cfac8645..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2O>Y}T7{{lSizy+9et~IAm35S?TUrT}mr9l!s1I(WH~~}yVZA%9m#%kLGqY|h zHw6ihkSOAexO3nJ2X0(If+G@#9ylNn2M+K7IP#y_@!AQgh{~zxS?QPc&d&4ppJyyt znclgV+a3PAf05yOnz7^G-F>Cqe3pIt7-K3(BO%ow9t7bHAAARBM_?3XlS%04YEUkOHItDL@L40{;UAbbgGzjXLmi-(Hv8{n&xKd!!pFKnjoo zqyQ;E3XlS%04YEUkOHItDL@K5f(ir?V{<{oexDS2=-+)g*2HpY}z;APm{S3YW_rM3>J@76VfgP|7*1$>d%aia0 zJ_gsoc`y%tIKkNW;B)Xkcn6Gt0B?e8U=_@RzfjY!;6C^od@0&H}5! zBe;f?GATd`kOHItDL@L40{>Y7zVF&&=5epSYVVwTYe9PZk~^GP_XDkiaL^40ViGjvE7dQ&4R`|Gj-dn0ZPHak(YPgKLn-;^KkPl}X z43Wwt<|vSSwi3S1Q*o1b<6)i%S7|x7Beck*uXG@Fk$e3jwP#no`k2*frtTVU=1)xu zUC5NDMUvQ2ktl(H)%!++yD53mOJX%>xzn%xIE}p0)5J-coAT|eu?sT^SF0Ux5T{B= z?UtrA+DwHv=DTsU;_7TiSYQ{VmIyr^Ugx3ooxpKqQ?HeeTO!P41c#a2KnF~V4`scq z%zE0NjgzvIrPnjRRUP*Aj4m$zG`x!d8<&8bgfyDC0`wqOet{Bg4K~5J@0kIYMToP+ znwtSQatmgjrc%tfusOI%E^}|e>AkSTrweSGCGK<2O^#Jp$Pt2$8Tv93VG>BeO()H^ z%?iifS!Iny-fdmk=rs9agRyddlsm)qz*d&v;B%~AO0r&%G^1gh#!AaTXVUZnN3RUC z5n8rNs8nEyM_I^i6jMF+Te*1-xZUUQMfil3k9Mf@J9qdbb{n$EB1Fj9876pfK=At~q0o$V_dSGU`(=5~AY zDg<9-m}wfJ(|mQewYjs^-RPnpF0SIY=FMu4_-e z$NMrH@&(@=VV}IfN%jRSeuKB{-sY43Zd*Sy{_GOWxGCG!T2F(PjaSVY+OMKUc|({g OIlI^XG0kj1%=#PJcqvT) From bfaf8ce77099fce4e4426650c14972148724086d Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 7 Jul 2016 18:06:22 -0400 Subject: [PATCH 006/102] publish subscribe --- .../imports/ui/components/explore/explore.ts | 4 +- client/imports/ui/pages/account/account.html | 6 +- client/imports/ui/pages/account/account.ts | 4 - collections/course_records.ts | 6 +- collections/courses.ts | 19 ++- collections/labs.ts | 12 +- tests/example_data/example_course.js | 145 ------------------ 7 files changed, 19 insertions(+), 177 deletions(-) delete mode 100644 tests/example_data/example_course.js diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index cb47a2c1..d0a07ba3 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -29,12 +29,12 @@ selector: 'tuxlab-exploreview', templateUrl: '/client/imports/ui/components/explore/explore.html', directives: [ - MATERIAL_DIRECTIVES, + MATERIAL_DIRECTIVES, MD_ICON_DIRECTIVES, MD_TABS_DIRECTIVES, MD_INPUT_DIRECTIVES, MdToolbar - ], + ], viewProviders: [ MdIconRegistry ], encapsulation: ViewEncapsulation.None }) diff --git a/client/imports/ui/pages/account/account.html b/client/imports/ui/pages/account/account.html index 70bf2db5..647ede8f 100644 --- a/client/imports/ui/pages/account/account.html +++ b/client/imports/ui/pages/account/account.html @@ -5,9 +5,9 @@ diff --git a/client/imports/ui/pages/account/account.ts b/client/imports/ui/pages/account/account.ts index 274aae37..870ff580 100644 --- a/client/imports/ui/pages/account/account.ts +++ b/client/imports/ui/pages/account/account.ts @@ -39,10 +39,6 @@ @InjectUser("user") export class Account extends MeteorComponent { user: Meteor.User; - imgsrc: String = "http://www.placekitten.com/g/250/250"; - name: String = "Name Here"; - school: String = "School Name Here"; - email: String = "example@example.com"; constructor(mdIconRegistry: MdIconRegistry) { super(); // Create Icon Font diff --git a/collections/course_records.ts b/collections/course_records.ts index 7ca04dcc..97c4c9a2 100644 --- a/collections/course_records.ts +++ b/collections/course_records.ts @@ -35,11 +35,11 @@ declare var SimpleSchema: any; if(Meteor.isServer) { - Meteor.publish('course-records', function() { + Meteor.publish('course-records', function() { const user = Meteor.users.findOne(this.userId); if(user) { return course_records.find({ - user_id: '1' // Change to user_id: this.userId + user_id: this.userId }, { fields: { 'labs.data': 0, @@ -50,7 +50,7 @@ if(Meteor.isServer) { else { return null; } - }); + }); Meteor.startup(function() { var taskSchema = new SimpleSchema({ _id: { diff --git a/collections/courses.ts b/collections/courses.ts index 81089202..aa9df6b8 100644 --- a/collections/courses.ts +++ b/collections/courses.ts @@ -8,8 +8,6 @@ import { course_records } from './course_records.ts'; export const courses = new Mongo.Collection('courses'); -const MAX_COURSES = 4; - /** AUTHENTICATION **/ @@ -30,16 +28,17 @@ courses.allow({ if (Meteor.isServer){ Meteor.publish('courses', function() { - const user = Meteor.users.findOne(this.userId); - if(user) { + if(this.userId) { let courseRecords = course_records.find({ _id: this.userId }); - let publishCourses = new Mongo.Collection(null); - courseRecords.forEach(function(cr) { - let courseId = cr.course_id; - publishCourses.insert(courses.findOne({ _id: courseId })); + let courseIds = courseRecords.map(function(cr) { + return (cr).course_id; }); - return courses.find({}); - // return publishCourses.find(); + const query = { + '_id': { + $in: courseIds + } + }; + return courses.find(query); } else { return null; diff --git a/collections/labs.ts b/collections/labs.ts index d5704ba4..f6686075 100644 --- a/collections/labs.ts +++ b/collections/labs.ts @@ -27,16 +27,8 @@ labs.allow({ if(Meteor.isServer) { Meteor.publish('labs', function() { - const user = Meteor.users.findOne({ _id: this.userId }); - if(user) { - let publishLabs = new Mongo.Collection(null); - labs.forEach(function(lb) { - let lab = lb; - if (lab.hidden === false) { - publishLabs.insert(lb); - } - }); - return publishLabs.find(); + if(this.userId) { + return labs.find({ hidden: false }); } else { return null; diff --git a/tests/example_data/example_course.js b/tests/example_data/example_course.js deleted file mode 100644 index c3f0326f..00000000 --- a/tests/example_data/example_course.js +++ /dev/null @@ -1,145 +0,0 @@ -/** - Example Data for the 15-131 -**/ - -// Import LabFile -var course_labfile = require('fs').readFileSync('./tests/example_data/example_labfile.js', "utf8").toString(); - -var course_obj = { - course_number: "15-131", - course_name: "Great Practical Ideas for Computer Scientists", - course_description: ` - Throughout your education as a Computer Scientist at Carnegie Mellon, - you will take courses on programming, theoretical ideas, logic, systems, etc. - As you progress, you will be expected to pick up the so-called “tools of the - trade.” This course is intended to help you learn what you need to know in a - friendly, low-stress, high-support way. We will discuss UNIX, LaTeX, - debugging and many other essential tools. - `, - instructor_name: "Tom Cortina", - file: course_labfile, - labs: [ - { - _id: 1, - lab_name: "Getting Started with Git", - file: course_labfile, - tasks: [ - { - _id: 1, - name: "Git Clone", - md: "Git Clone Testing!" - } - ] - } - ] -} - -module.exports = course_obj; - - -// More Sample Data -/* -var myCourse1 = { - course_number: '15-122', - course_name: 'Principles of Imperative Programming', - course_description: ` - This course teaches imperative programming and methods for ensuring the correctness - of programs. It is intended for students with a basic understanding of programming - (variables, expressions, loops, arrays, functions). Students will learn the process - and concepts needed to go from high-level descriptions of algorithms to correct - imperative implementations, with specific applications to basic data structures - and algorithms. Much of the course will be conducted in a subset of C amenable - to verification, with a transition to full C near the end. - `, - instructor_name: 'Tom Cortina', - labs: [ - '574467bc11091623418a429d', - '574467bc110as623418a429d', - '574467bc11fab623418a429d' - ] -}; - -var myCourse2 = { - course_number: '15-131', - course_name: 'Great Practical Ideas for Computer Scientists', - course_description: ` - Throughout your education as a Computer Scientist at Carnegie Mellon, you will - take courses on programming, theoretical ideas, logic, systems, etc. As you progress, - you will be expected to pick up the so-called “tools of the trade.” This course is - intended to help you learn what you need to know in a friendly, low-stress, high-support - way. We will discuss UNIX, LaTeX, debugging and many other essential tools. - `, - instructor_name: 'Derek Brown', - labs: [ - '574467bc11091623418a429d', - '574467bc110as623418a429d', - '574467bc11fab623418a429d' - ] -}; - -var myCourse3 = { - course_number: '15-150', - course_name: 'Principles of Functional Programming', - course_description: ` - The purpose of this course is to introduce the theory and practice of functional - programming (FP). The characteristic feature of FP is the emphasis on computation - as evaluation. The traditional distinction between program and data characteristic of - imperative programming (IP) is replaced by an emphasis on classifying expressions by - types that specify their applicative behavior. Types include familiar (fixed and arbitrary - precision) numeric types, tuples and records (structs), classified values (objects), - inductive types such as trees, functions with specified inputs and outputs, and commands - such as input and output. Well-typed expressions are evaluated to produce values, - in a manner that is guaranteed to be type-safe. Because functional programs do not cause - side-effects we can take advantage of simple mathematical principles in reasoning about - applicative behavior and analyzing the runtime properties of programs. - `, - instructor_name: 'Michael Erdman', - labs: [ - '574467bc11091623418a429d', - '574467bc110as623418a429d', - '574467bc11fab623418a429d' - ] -}; - -var myCourse4 = { - course_number: '15-251', - course_name: 'Great Theoretical Ideas in Computer Science', - course_description: ` - Welcome to 15-251! This course will take a philosophical and historical perspective on - the development of theoretical computer science. From using a pile of stones to represent - and manipulate numbers, humans have progressively developed an abstract vocabulary with - which to mathematically represent their world. The ancients, especially the Greeks, - realized that they could consistently reason about their representations in a step-by-step - manner. In other words, by computing in abstract models, they could describe and - predict patterns in the world around them. - `, - instructor_name: 'Bernhard Haeupler', - labs: [ - '574467bc11091623418a429d', - '574467bc110as623418a429d', - '574467bc11fab623418a429d' - ] -}; - -var myCourse5 = { - course_number: '15-322', - course_name: 'Introduction to Computer Music', - course_description: ` - Computers are used to synthesize sound, process signals, and compose music. Personal - computers have replaced studios full of sound recording and processing equipment, - completing a revolution that began with recording and electronics. In this - course, students will learn the fundamentals of digital audio, basic sound - synthesis algorithms, and techniques for digital audio effects and processing. - Students will apply their knowledge in programming assignments using a very high-level - programming language for sound synthesis and composition. In a final project, - students will demonstrate their mastery of tools and techniques through a publicly - performed music composition. - `, - instructor_name: 'Jesse Styles', - labs: [ - '574467bc11091623418a429d', - '574467bc110as623418a429d', - '574467bc11fab623418a429d' - ] -}; -*/ From 5123b2fd25118396736b4323cc94e2df480b9ecd Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 8 Jul 2016 13:25:02 -0400 Subject: [PATCH 007/102] template fixes --- .../ui/components/explore/explore.html | 6 +- .../imports/ui/components/explore/explore.ts | 7 +- .../imports/ui/components/explore/search.html | 28 ++++--- .../imports/ui/components/explore/search.ts | 78 ++----------------- .../imports/ui/components/lablist/lablist.ts | 6 +- client/imports/ui/pages/account/account.html | 2 +- client/imports/ui/pages/course/course.ts | 52 +++++++------ client/imports/ui/pages/explore/explore.html | 4 +- client/index.html | 4 +- client/style/base/_body.scss | 12 ++- client/style/base/_toolbar.scss | 26 ++++--- client/style/dashboard/_dashboard.scss | 2 +- client/style/explore/_explore.scss | 21 ++--- client/tuxlab.html | 30 +++---- client/tuxlab.ts | 1 + collections/course_records.ts | 3 +- collections/courses.ts | 16 +++- public/assets | 2 +- 18 files changed, 123 insertions(+), 177 deletions(-) diff --git a/client/imports/ui/components/explore/explore.html b/client/imports/ui/components/explore/explore.html index b4028e99..77c81a5b 100644 --- a/client/imports/ui/components/explore/explore.html +++ b/client/imports/ui/components/explore/explore.html @@ -6,7 +6,7 @@ diff --git a/client/imports/ui/components/explore/search.html b/client/imports/ui/components/explore/search.html index 9a28e276..7f8a83d9 100644 --- a/client/imports/ui/components/explore/search.html +++ b/client/imports/ui/components/explore/search.html @@ -28,7 +28,7 @@

Search Results for '{{ searchQuery }}'

{{ course.course_name }} {{ course.instructor_ids }} - Course Page + Enroll diff --git a/client/imports/ui/pages/lab/taskview.html b/client/imports/ui/pages/lab/taskview.html index 5af75603..68180c69 100644 --- a/client/imports/ui/pages/lab/taskview.html +++ b/client/imports/ui/pages/lab/taskview.html @@ -5,12 +5,11 @@ - - Task 1 - Task 2 - Task 3 - Task 4 - Task 5 + + + {{ task.name }} + + @@ -23,7 +22,7 @@

{{ taskName }}

diff --git a/client/imports/ui/pages/lab/taskview.ts b/client/imports/ui/pages/lab/taskview.ts index 09902939..3804743d 100644 --- a/client/imports/ui/pages/lab/taskview.ts +++ b/client/imports/ui/pages/lab/taskview.ts @@ -52,10 +52,19 @@ export default class TaskView extends MeteorComponent { labMarkdown: string; taskName: string = "Task Name Here"; labProgress: string = "3 / 10"; + tasks: Array; @ViewChild(Terminal) term : Terminal; constructor() { super(); + this.tasks = [ + { id: 1, name: "Task 1", completed: true }, + { id: 2, name: "Task 2", completed: true }, + { id: 3, name: "Task 3", completed: true }, + { id: 4, name: "Task 4", completed: false }, + { id: 5, name: "Task 5", completed: true }, + { id: 6, name: "Task 6", completed: false }, + ]; } ngAfterViewInit(){ diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index b415b591..8247c4e4 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -46,23 +46,33 @@ width: 50%; md-sidenav-layout { height: 100vh; + md-sidenav { + width: 260px; + padding: 0; + a { + color: black; + display: block; + width: 260px; + height: 50px; + margin: 0; + line-height: 50px; + text-align: left; + padding-left: 15px; + padding-right: 15px; + md-icon { + float: right; + color: #64dd17; + } + .tuxicon-tick:before { + font-size: 36px + } + } + } } md-content { padding: 0; background-color: #e5e6e6; } - md-sidenav { - width: 260px; - padding: 0; - a { - color: black; - display: block; - width: 260px; - height: 50px; - margin: 0; - line-height: 50px; - } - } md-sidenav-layout.md-sidenav-opened { width: 50%; } From 7d8ea64334aed25955ce570b6dd3efd9877e092e Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 21 Jul 2016 12:39:58 -0400 Subject: [PATCH 057/102] taskview --- client/imports/ui/pages/lab/taskview.html | 9 +++++---- client/imports/ui/pages/lab/taskview.ts | 5 ++++- client/style/lab/_labview.scss | 8 ++++++++ public/assets | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/imports/ui/pages/lab/taskview.html b/client/imports/ui/pages/lab/taskview.html index 68180c69..bb5de72a 100644 --- a/client/imports/ui/pages/lab/taskview.html +++ b/client/imports/ui/pages/lab/taskview.html @@ -5,7 +5,8 @@ - + + Course Page {{ task.name }} @@ -21,9 +22,9 @@

{{ taskName }}

diff --git a/client/imports/ui/pages/lab/taskview.ts b/client/imports/ui/pages/lab/taskview.ts index 3804743d..e5766e38 100644 --- a/client/imports/ui/pages/lab/taskview.ts +++ b/client/imports/ui/pages/lab/taskview.ts @@ -7,6 +7,7 @@ // Angular Imports import { ViewChild, Component, ViewEncapsulation, provide, Input } from '@angular/core'; import { bootstrap } from 'angular2-meteor-auto-bootstrap'; + import { ROUTER_DIRECTIVES } from '@angular/router'; // Angular Material Imports import { MeteorComponent } from 'angular2-meteor'; @@ -38,7 +39,8 @@ MATERIAL_DIRECTIVES, MD_INPUT_DIRECTIVES, MD_SIDENAV_DIRECTIVES, - MD_TOOLBAR_DIRECTIVES + MD_TOOLBAR_DIRECTIVES, + ROUTER_DIRECTIVES ], viewProviders: [ MdIconRegistry ], providers: [ OVERLAY_PROVIDERS, MATERIAL_PROVIDERS ], @@ -53,6 +55,7 @@ export default class TaskView extends MeteorComponent { taskName: string = "Task Name Here"; labProgress: string = "3 / 10"; tasks: Array; + courseId: string; @ViewChild(Terminal) term : Terminal; constructor() { diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index 8247c4e4..f82b04ee 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -96,6 +96,13 @@ div{ height: 100%; } + + .tuxicon-lines:before { + font-size: 48px; + } + md-icon { + line-height: 12px; + } .markdown-task-name { font-size: 24px; @@ -108,6 +115,7 @@ a.markdown-back-link { text-decoration: none; color: black; + cursor: pointer; } } } diff --git a/public/assets b/public/assets index 18b772f4..4ca0a4ea 160000 --- a/public/assets +++ b/public/assets @@ -1 +1 @@ -Subproject commit 18b772f43ccd9e1a267c92abeed12b593bb54f49 +Subproject commit 4ca0a4eaf74cdb1ead07ddce329949fd3b9da104 From 0c1a57446a8945c2674a64f6bcfe895113ca7449 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 21 Jul 2016 16:57:53 -0400 Subject: [PATCH 058/102] taskview sidenav changes --- client/imports/ui/pages/course/course.html | 16 ++++++++-------- .../imports/ui/pages/course/course.routes.ts | 10 ++++++---- client/imports/ui/pages/course/course.ts | 11 ++++++++++- .../imports/ui/pages/dashboard/dashboard.html | 2 +- client/imports/ui/pages/lab/taskview.html | 3 ++- client/imports/ui/pages/lab/taskview.ts | 19 +++++++++++++------ client/style/lab/_labview.scss | 6 ++++++ client/tuxlab.html | 2 +- public/assets | 2 +- 9 files changed, 48 insertions(+), 23 deletions(-) diff --git a/client/imports/ui/pages/course/course.html b/client/imports/ui/pages/course/course.html index 54544aec..1b202fd5 100644 --- a/client/imports/ui/pages/course/course.html +++ b/client/imports/ui/pages/course/course.html @@ -5,19 +5,19 @@
- Home - Labs - Grades + Home + Labs + Grades
- Home - Labs - Grades - More - More + Home + Labs + Grades + More + More
diff --git a/client/imports/ui/pages/course/course.routes.ts b/client/imports/ui/pages/course/course.routes.ts index 9c5d9934..c0898534 100644 --- a/client/imports/ui/pages/course/course.routes.ts +++ b/client/imports/ui/pages/course/course.routes.ts @@ -4,16 +4,18 @@ import { GradeList } from './gradelist.ts'; import { LabList } from './lablist.ts'; import { CourseDashboard } from './course_dashboard.ts'; import { LabView } from './labview.ts'; +import { GradeView } from './gradeview.ts'; export const courseRoutes: RouterConfig = [ { path: 'course', component: CourseView, children: [ - { path: '', component: CourseDashboard }, - { path: 'grades', component: GradeList }, - { path: 'labs', component: LabList }, - { path: 'labs/lab', component: LabView } + { path: ':courseid', component: CourseDashboard }, + { path: ':courseid/grades', component: GradeList }, + { path: ':courseid/labs', component: LabList }, + { path: ':courseid/labs/lab', component: LabView }, + { path: ':courseid/grades/grade', component: GradeView } // { path: '/:courseid', as: 'CourseView', component: CourseView }, // { path: '/:courseid/users', as: 'UserList', component: UserList }, // { path: '/:courseid/user/:userid', as: 'UserView', component: UserView }, diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index fa159e11..e721f469 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -11,6 +11,7 @@ import { HTTP_PROVIDERS } from '@angular/http'; import { InjectUser } from 'angular2-meteor-accounts-ui'; import { ROUTER_DIRECTIVES } from '@angular/router'; + import { ActivatedRoute } from '@angular/router'; // Angular Material Imports import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; @@ -24,6 +25,8 @@ import { courses } from "../../../../../collections/courses.ts"; import { course_records } from "../../../../../collections/course_records.ts"; +declare var Collections: any; + // Define CourseView Component @Component({ selector: 'tuxlab-courseview', @@ -40,10 +43,16 @@ // Export CourseView Class export default class CourseView extends MeteorComponent { - constructor(mdIconRegistry: MdIconRegistry) { + courseId: string; + constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) { super(); // Create Icon Font mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); } + + ngOnInit() { + this.courseId = this.route.snapshot.params['courseid']; + } + } diff --git a/client/imports/ui/pages/dashboard/dashboard.html b/client/imports/ui/pages/dashboard/dashboard.html index c2263c6f..5ef93292 100644 --- a/client/imports/ui/pages/dashboard/dashboard.html +++ b/client/imports/ui/pages/dashboard/dashboard.html @@ -7,7 +7,7 @@
- +

{{ course.course_name }}

{{ course.course_number }} diff --git a/client/imports/ui/pages/lab/taskview.html b/client/imports/ui/pages/lab/taskview.html index 49bed30b..b0b2c959 100644 --- a/client/imports/ui/pages/lab/taskview.html +++ b/client/imports/ui/pages/lab/taskview.html @@ -7,9 +7,10 @@
Course Page - + {{ task.name }} + diff --git a/client/imports/ui/pages/lab/taskview.ts b/client/imports/ui/pages/lab/taskview.ts index e5766e38..695452ef 100644 --- a/client/imports/ui/pages/lab/taskview.ts +++ b/client/imports/ui/pages/lab/taskview.ts @@ -55,18 +55,19 @@ export default class TaskView extends MeteorComponent { taskName: string = "Task Name Here"; labProgress: string = "3 / 10"; tasks: Array; + currentTask: number; courseId: string; @ViewChild(Terminal) term : Terminal; constructor() { super(); this.tasks = [ - { id: 1, name: "Task 1", completed: true }, - { id: 2, name: "Task 2", completed: true }, - { id: 3, name: "Task 3", completed: true }, - { id: 4, name: "Task 4", completed: false }, - { id: 5, name: "Task 5", completed: true }, - { id: 6, name: "Task 6", completed: false }, + { id: 1, name: "Task 1", completed: true, md: "# Task 1" }, + { id: 2, name: "Task 2", completed: true, md: "# Task 2" }, + { id: 3, name: "Task 3", completed: true, md: "# Task 3" }, + { id: 4, name: "Task 4", completed: false, md: "# Task 4" }, + { id: 5, name: "Task 5", completed: true, md: "# Task 5" }, + { id: 6, name: "Task 6", completed: false, md: "# Task 6" }, ]; } @@ -83,4 +84,10 @@ export default class TaskView extends MeteorComponent { console.log("fired",err,res); }); } + + toTask(task) { + this.labMarkdown = task.md; + this.currentTask = task.id; + } + } diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index f82b04ee..6e5fd337 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -66,6 +66,12 @@ .tuxicon-tick:before { font-size: 36px } + .tuxicon-progress:before { + font-size: 36px; + } + md-icon.progress { + color: #afafaf; + } } } } diff --git a/client/tuxlab.html b/client/tuxlab.html index a7ef5c4e..75094d58 100644 --- a/client/tuxlab.html +++ b/client/tuxlab.html @@ -20,7 +20,7 @@ Terminal - + Settings diff --git a/public/assets b/public/assets index 4ca0a4ea..bac57f8b 160000 --- a/public/assets +++ b/public/assets @@ -1 +1 @@ -Subproject commit 4ca0a4eaf74cdb1ead07ddce329949fd3b9da104 +Subproject commit bac57f8b0ed7c81e45d1dcad51ecb193bfc2885e From 1c36be09dd1f8f036ffba4e9f05e0c0e0bea403a Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 21 Jul 2016 17:28:04 -0400 Subject: [PATCH 059/102] Extend terminal on small width --- client/imports/ui/pages/lab/taskview.html | 2 +- client/style/lab/_labview.scss | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/imports/ui/pages/lab/taskview.html b/client/imports/ui/pages/lab/taskview.html index b0b2c959..e710364c 100644 --- a/client/imports/ui/pages/lab/taskview.html +++ b/client/imports/ui/pages/lab/taskview.html @@ -56,7 +56,7 @@
- +
diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index 6e5fd337..dfca2d0a 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -37,6 +37,16 @@ padding:10px; } } + + } + + @media screen and (max-width: 800px) { + .tuxlab-taskview-terminal { + width: 100%; + } + .tuxlab-taskview-step { + display: none; + } } /** @@ -178,4 +188,4 @@ } } } -} +} \ No newline at end of file From d72d173958e2a04164429b78efec9691f66e4079 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 21 Jul 2016 17:34:22 -0400 Subject: [PATCH 060/102] . --- client/imports/ui/pages/course/course.ts | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index e721f469..64ccba38 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -1,31 +1,31 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; - import { Mongo } from 'meteor/mongo'; - import 'reflect-metadata'; - import 'zone.js/dist/zone'; + import { Meteor } from 'meteor/meteor'; + import { Mongo } from 'meteor/mongo'; + import 'reflect-metadata'; + import 'zone.js/dist/zone'; // Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; - import { bootstrap } from 'angular2-meteor-auto-bootstrap'; - import { APP_BASE_HREF } from '@angular/common'; - import { HTTP_PROVIDERS } from '@angular/http'; - import { InjectUser } from 'angular2-meteor-accounts-ui'; - import { ROUTER_DIRECTIVES } from '@angular/router'; - import { ActivatedRoute } from '@angular/router'; + import { Component, ViewEncapsulation, provide } from '@angular/core'; + import { bootstrap } from 'angular2-meteor-auto-bootstrap'; + import { APP_BASE_HREF } from '@angular/common'; + import { HTTP_PROVIDERS } from '@angular/http'; + import { InjectUser } from 'angular2-meteor-accounts-ui'; + import { ROUTER_DIRECTIVES } from '@angular/router'; + import { ActivatedRoute } from '@angular/router'; // Angular Material Imports - import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; - import { MeteorComponent } from 'angular2-meteor'; - import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay'; + import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; + import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay'; // Icon - import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; + import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; // Courses and Course Record Imports - import { courses } from "../../../../../collections/courses.ts"; - import { course_records } from "../../../../../collections/course_records.ts"; + import { courses } from "../../../../../collections/courses.ts"; + import { course_records } from "../../../../../collections/course_records.ts"; -declare var Collections: any; + declare var Collections: any; // Define CourseView Component @Component({ @@ -50,9 +50,9 @@ declare var Collections: any; mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); } - - ngOnInit() { - this.courseId = this.route.snapshot.params['courseid']; - } - + + ngOnInit() { + this.courseId = this.route.snapshot.params['courseid']; + } + } From bdb4c548bee03f496b276612ad48f83b21d8d287 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 21 Jul 2016 17:35:49 -0400 Subject: [PATCH 061/102] . --- client/imports/ui/pages/course/course.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index 64ccba38..55f5af81 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -43,7 +43,7 @@ // Export CourseView Class export default class CourseView extends MeteorComponent { - courseId: string; + courseId: string; constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) { super(); // Create Icon Font From 3ced6c66dd7ddc110b3fa571613c51d001006d3f Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 11:50:04 -0400 Subject: [PATCH 062/102] Added UserList Component in Courses --- client/imports/ui/pages/course/course.html | 18 ++++++------ .../imports/ui/pages/course/course.routes.ts | 4 ++- client/imports/ui/pages/course/course.ts | 4 +++ client/imports/ui/pages/course/userlist.html | 28 +++++++++++++++++++ client/imports/ui/pages/course/userlist.ts | 28 +++++++++++++++++++ 5 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 client/imports/ui/pages/course/userlist.html create mode 100644 client/imports/ui/pages/course/userlist.ts diff --git a/client/imports/ui/pages/course/course.html b/client/imports/ui/pages/course/course.html index 1b202fd5..9eab99f6 100644 --- a/client/imports/ui/pages/course/course.html +++ b/client/imports/ui/pages/course/course.html @@ -5,19 +5,21 @@ diff --git a/client/imports/ui/pages/course/course.routes.ts b/client/imports/ui/pages/course/course.routes.ts index c0898534..31c5c42f 100644 --- a/client/imports/ui/pages/course/course.routes.ts +++ b/client/imports/ui/pages/course/course.routes.ts @@ -5,6 +5,7 @@ import { LabList } from './lablist.ts'; import { CourseDashboard } from './course_dashboard.ts'; import { LabView } from './labview.ts'; import { GradeView } from './gradeview.ts'; +import { UserList } from './userlist.ts'; export const courseRoutes: RouterConfig = [ { @@ -15,7 +16,8 @@ export const courseRoutes: RouterConfig = [ { path: ':courseid/grades', component: GradeList }, { path: ':courseid/labs', component: LabList }, { path: ':courseid/labs/lab', component: LabView }, - { path: ':courseid/grades/grade', component: GradeView } + { path: ':courseid/grades/grade', component: GradeView }, + { path: ':courseid/users', component: UserList } // { path: '/:courseid', as: 'CourseView', component: CourseView }, // { path: '/:courseid/users', as: 'UserList', component: UserList }, // { path: '/:courseid/user/:userid', as: 'UserView', component: UserView }, diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index 55f5af81..727750d4 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -27,6 +27,7 @@ declare var Collections: any; + // Define CourseView Component @Component({ selector: 'tuxlab-courseview', @@ -41,9 +42,11 @@ encapsulation: ViewEncapsulation.None }) +@InjectUser('user') // Export CourseView Class export default class CourseView extends MeteorComponent { courseId: string; + user: Meteor.User; constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) { super(); // Create Icon Font @@ -53,6 +56,7 @@ ngOnInit() { this.courseId = this.route.snapshot.params['courseid']; + console.log(this.user); } } diff --git a/client/imports/ui/pages/course/userlist.html b/client/imports/ui/pages/course/userlist.html new file mode 100644 index 00000000..97f1e3c5 --- /dev/null +++ b/client/imports/ui/pages/course/userlist.html @@ -0,0 +1,28 @@ +
+ + + + Enrolled Users + + + + + + + Username + First Name + Last Name + + + + + {{ student.nickname }} + {{ student.first_name }} + {{ student.last_name }} + + + + + + +
\ No newline at end of file diff --git a/client/imports/ui/pages/course/userlist.ts b/client/imports/ui/pages/course/userlist.ts new file mode 100644 index 00000000..6127febb --- /dev/null +++ b/client/imports/ui/pages/course/userlist.ts @@ -0,0 +1,28 @@ +// Meteor Imports + import { Meteor } from 'meteor/meteor'; + import { Mongo } from 'meteor/mongo'; +// Angular Imports + import { Component } from '@angular/core'; + +// Angular Meteor Imports + import { MeteorComponent } from 'angular2-meteor'; + +// Define UserList Component +@Component({ + selector: 'tuxlab-userlist', + templateUrl: '/client/imports/ui/pages/course/userlist.html', + directives: [] +}) + +export class UserList extends MeteorComponent { + students: Array; + constructor() { + super(); + this.students = [ + { id: 1, nickname: "sandershihacker", first_name: "Sander", last_name: "Shi" }, + { id: 2, nickname: "derekbro", first_name: "Derek", last_name: "Brown" }, + { id: 3, nickname: "amortenson", first_name: "Aaron", last_name: "Mortenson" }, + { id: 4, nickname: "cersoz", first_name: "Cem", last_name: "Ersoz" }, + ]; + } +} \ No newline at end of file From e0e92ca526986133f92f231f252e5bb071c7f5da Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 12:44:23 -0400 Subject: [PATCH 063/102] Edit Course --- .../ui/pages/course/course_dashboard.html | 29 +++++++-- .../ui/pages/course/course_dashboard.ts | 64 ++++++++++--------- client/imports/ui/pages/lab/taskview.html | 2 +- client/imports/ui/pages/lab/taskview.ts | 2 + 4 files changed, 61 insertions(+), 36 deletions(-) diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 5b59b6a1..a181ca03 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -1,6 +1,5 @@
- @@ -14,15 +13,17 @@ Course Website - + +
+ +
-
+ +
- - @@ -55,7 +56,25 @@
+
+ + + + + + Edit Course + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 1f0cec29..5ad4a413 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -1,48 +1,52 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; - import { Mongo } from 'meteor/mongo'; - import 'reflect-metadata'; - import 'zone.js/dist/zone'; + import { Meteor } from 'meteor/meteor'; + import { Mongo } from 'meteor/mongo'; + import 'reflect-metadata'; + import 'zone.js/dist/zone'; // Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; - import { bootstrap } from 'angular2-meteor-auto-bootstrap'; - import { APP_BASE_HREF } from '@angular/common'; - import { HTTP_PROVIDERS } from '@angular/http'; - import { InjectUser } from 'angular2-meteor-accounts-ui'; - import { ROUTER_DIRECTIVES } from '@angular/router'; + import { Component, ViewEncapsulation, provide } from '@angular/core'; + import { bootstrap } from 'angular2-meteor-auto-bootstrap'; + import { APP_BASE_HREF, FORM_DIRECTIVES } from '@angular/common'; + import { HTTP_PROVIDERS } from '@angular/http'; + 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 {OVERLAY_PROVIDERS} from '@angular2-material/core/overlay/overlay'; + import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; + import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay'; + import { MD_INPUT_DIRECTIVES } from '@angular2-material/input'; + // Icon - import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; + import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; // LabList and Grades import import { GradeList } from './gradelist.ts'; import { LabList } from './lablist.ts'; - + // Courses and Course Record Imports - import { courses } from "../../../../../collections/courses.ts"; - import { course_records } from "../../../../../collections/course_records.ts"; + import { courses } from "../../../../../collections/courses.ts"; + import { course_records } from "../../../../../collections/course_records.ts"; // Define CourseDashboard Component - @Component({ - selector: 'tuxlab-course-dashboard', - templateUrl: '/client/imports/ui/pages/course/course_dashboard.html', - directives: [ - MATERIAL_DIRECTIVES, - MD_ICON_DIRECTIVES, - ROUTER_DIRECTIVES, - LabList, + @Component({ + selector: 'tuxlab-course-dashboard', + templateUrl: '/client/imports/ui/pages/course/course_dashboard.html', + directives: [ + MATERIAL_DIRECTIVES, + MD_ICON_DIRECTIVES, + ROUTER_DIRECTIVES, + FORM_DIRECTIVES, + MD_INPUT_DIRECTIVES, + LabList, GradeList - ], - viewProviders: [MdIconRegistry], - providers: [OVERLAY_PROVIDERS], - encapsulation: ViewEncapsulation.None - }) + ], + viewProviders: [MdIconRegistry], + providers: [OVERLAY_PROVIDERS], + encapsulation: ViewEncapsulation.None + }) // Export CourseDashboard Class export class CourseDashboard extends MeteorComponent { diff --git a/client/imports/ui/pages/lab/taskview.html b/client/imports/ui/pages/lab/taskview.html index e710364c..147e47c6 100644 --- a/client/imports/ui/pages/lab/taskview.html +++ b/client/imports/ui/pages/lab/taskview.html @@ -42,7 +42,7 @@

Checking Task...

- diff --git a/client/imports/ui/pages/lab/taskview.ts b/client/imports/ui/pages/lab/taskview.ts index 695452ef..95434953 100644 --- a/client/imports/ui/pages/lab/taskview.ts +++ b/client/imports/ui/pages/lab/taskview.ts @@ -56,6 +56,7 @@ export default class TaskView extends MeteorComponent { labProgress: string = "3 / 10"; tasks: Array; currentTask: number; + currentCompleted: boolean; courseId: string; @ViewChild(Terminal) term : Terminal; @@ -88,6 +89,7 @@ export default class TaskView extends MeteorComponent { toTask(task) { this.labMarkdown = task.md; this.currentTask = task.id; + this.currentCompleted = task.completed; } } From 88de30c0aa5545a6c8b91c509765e8d92d51d5b1 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 14:18:14 -0400 Subject: [PATCH 064/102] . --- client/imports/ui/pages/lab/taskview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/imports/ui/pages/lab/taskview.ts b/client/imports/ui/pages/lab/taskview.ts index ce683566..b2c74220 100644 --- a/client/imports/ui/pages/lab/taskview.ts +++ b/client/imports/ui/pages/lab/taskview.ts @@ -108,7 +108,7 @@ export default class TaskView extends MeteorComponent { toTask(task) { this.labMarkdown = task.md; this.currentTask = task.id; - this.currentCompleted = task.completed; + this.currentCompleted = task.completed; } } From d45f0ccadc219129f6d204476c7046f9cbc27b35 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 15:17:35 -0400 Subject: [PATCH 065/102] course dashboard get courseid from url --- client/imports/ui/pages/course/course.ts | 13 +++--------- .../ui/pages/course/course_dashboard.ts | 20 ++++++++++--------- package.json | 2 +- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index 7dd85d71..91b30e66 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -5,13 +5,12 @@ import 'zone.js/dist/zone'; // Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; + import { Component, ViewEncapsulation, provide, OnInit } from '@angular/core'; import { bootstrap } from 'angular2-meteor-auto-bootstrap'; import { APP_BASE_HREF } from '@angular/common'; import { HTTP_PROVIDERS } from '@angular/http'; import { InjectUser } from 'angular2-meteor-accounts-ui'; - import { ROUTER_DIRECTIVES } from '@angular/router'; - import { ActivatedRoute } from '@angular/router'; + import { ROUTER_DIRECTIVES, ActivatedRoute } from '@angular/router'; // Angular Material Imports import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; @@ -21,10 +20,6 @@ // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; -// Courses and Course Record Imports - import { courses } from "../../../../../collections/courses.ts"; - import { course_records } from "../../../../../collections/course_records.ts"; - declare var Collections: any; // Define CourseView Component @@ -52,9 +47,7 @@ mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); } - ngOnInit() { - this.courseId = this.route.snapshot.params['courseid']; + this.courseId = ((this.route.snapshot.params)).courseid; } - } diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 5ad4a413..554c98a3 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -5,12 +5,12 @@ import 'zone.js/dist/zone'; // Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; + import { Component, ViewEncapsulation, provide, OnInit } from '@angular/core'; import { bootstrap } from 'angular2-meteor-auto-bootstrap'; import { APP_BASE_HREF, FORM_DIRECTIVES } from '@angular/common'; import { HTTP_PROVIDERS } from '@angular/http'; import { InjectUser } from 'angular2-meteor-accounts-ui'; - import { ROUTER_DIRECTIVES } from '@angular/router'; + import { ROUTER_DIRECTIVES, ActivatedRoute } from '@angular/router'; // Angular Material Imports import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; @@ -18,7 +18,6 @@ import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay'; import { MD_INPUT_DIRECTIVES } from '@angular2-material/input'; - // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; @@ -51,22 +50,25 @@ // Export CourseDashboard Class export class CourseDashboard extends MeteorComponent { course; - courseNumber: String = '15-131'; // TODO: Get from URL - courseDescription: String = "Course Description Not Found"; - courseName: String = "Course Name Not Found"; + courseId: string; + courseDescription: String = ""; + courseName: String = ""; - constructor(mdIconRegistry: MdIconRegistry) { + constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) { super(); // Create Icon Font mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); mdIconRegistry.setDefaultFontSetClass('tuxicon'); // Subscribe to courses database and set current course - this.subscribe('user-courses', this.courseNumber, () => { - this.course = courses.findOne({ course_number: this.courseNumber }); + this.subscribe('user-courses', this.courseId, () => { + this.course = courses.findOne({ _id: this.courseId }); if (typeof this.course !== "undefined") { this.courseName = this.course.course_name; this.courseDescription = this.course.course_description.content; } }, true); } + ngOnInit() { + this.courseId = ((this.route.snapshot.params)).courseid; + } } \ No newline at end of file diff --git a/package.json b/package.json index 2d1c2552..2099a174 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@angular2-material/checkbox": "2.0.0-alpha.5-3", "@angular2-material/core": "2.0.0-alpha.5-2", "@angular2-material/icon": "2.0.0-alpha.5-2", - "@angular2-material/input": "2.0.0-alpha.5-3", + "@angular2-material/input": "^2.0.0-alpha.5-3", "@angular2-material/progress-bar": "2.0.0-alpha.5-3", "@angular2-material/progress-circle": "2.0.0-alpha.5-3", "@angular2-material/radio": "2.0.0-alpha.5-3", From a4c08f73421e8dc81bca7d09e7971ba5949f89db Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 15:27:01 -0400 Subject: [PATCH 066/102] delete userlist --- client/imports/ui/pages/course/course.html | 2 -- .../imports/ui/pages/course/course.routes.ts | 4 +-- client/imports/ui/pages/course/course.ts | 2 +- .../ui/pages/course/course_dashboard.html | 1 - .../ui/pages/course/course_dashboard.ts | 8 ++---- client/imports/ui/pages/course/userlist.html | 28 ------------------- client/imports/ui/pages/course/userlist.ts | 28 ------------------- 7 files changed, 5 insertions(+), 68 deletions(-) delete mode 100644 client/imports/ui/pages/course/userlist.html delete mode 100644 client/imports/ui/pages/course/userlist.ts diff --git a/client/imports/ui/pages/course/course.html b/client/imports/ui/pages/course/course.html index 941b9431..63eebb89 100644 --- a/client/imports/ui/pages/course/course.html +++ b/client/imports/ui/pages/course/course.html @@ -8,7 +8,6 @@ Home Labs Grades - Users Settings @@ -18,7 +17,6 @@ Home Labs Grades - Users Settings diff --git a/client/imports/ui/pages/course/course.routes.ts b/client/imports/ui/pages/course/course.routes.ts index 31c5c42f..c0898534 100644 --- a/client/imports/ui/pages/course/course.routes.ts +++ b/client/imports/ui/pages/course/course.routes.ts @@ -5,7 +5,6 @@ import { LabList } from './lablist.ts'; import { CourseDashboard } from './course_dashboard.ts'; import { LabView } from './labview.ts'; import { GradeView } from './gradeview.ts'; -import { UserList } from './userlist.ts'; export const courseRoutes: RouterConfig = [ { @@ -16,8 +15,7 @@ export const courseRoutes: RouterConfig = [ { path: ':courseid/grades', component: GradeList }, { path: ':courseid/labs', component: LabList }, { path: ':courseid/labs/lab', component: LabView }, - { path: ':courseid/grades/grade', component: GradeView }, - { path: ':courseid/users', component: UserList } + { path: ':courseid/grades/grade', component: GradeView } // { path: '/:courseid', as: 'CourseView', component: CourseView }, // { path: '/:courseid/users', as: 'UserList', component: UserList }, // { path: '/:courseid/user/:userid', as: 'UserView', component: UserView }, diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index 91b30e66..2eadee48 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -48,6 +48,6 @@ mdIconRegistry.setDefaultFontSetClass('tuxicon'); } ngOnInit() { - this.courseId = ((this.route.snapshot.params)).courseid; + this.courseId = (((this.route.snapshot.params)).courseid); } } diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index a181ca03..7b097e9a 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -72,7 +72,6 @@
-
diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 554c98a3..739c6743 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -25,9 +25,7 @@ import { GradeList } from './gradelist.ts'; import { LabList } from './lablist.ts'; -// Courses and Course Record Imports - import { courses } from "../../../../../collections/courses.ts"; - import { course_records } from "../../../../../collections/course_records.ts"; +declare var Collections: any; // Define CourseDashboard Component @Component({ @@ -61,7 +59,7 @@ mdIconRegistry.setDefaultFontSetClass('tuxicon'); // Subscribe to courses database and set current course this.subscribe('user-courses', this.courseId, () => { - this.course = courses.findOne({ _id: this.courseId }); + this.course = Collections.courses.findOne({ _id: this.courseId }); if (typeof this.course !== "undefined") { this.courseName = this.course.course_name; this.courseDescription = this.course.course_description.content; @@ -69,6 +67,6 @@ }, true); } ngOnInit() { - this.courseId = ((this.route.snapshot.params)).courseid; + this.courseId = (((this.route.snapshot.params)).courseid); } } \ No newline at end of file diff --git a/client/imports/ui/pages/course/userlist.html b/client/imports/ui/pages/course/userlist.html deleted file mode 100644 index 97f1e3c5..00000000 --- a/client/imports/ui/pages/course/userlist.html +++ /dev/null @@ -1,28 +0,0 @@ -
- - - - Enrolled Users - - - - - - - Username - First Name - Last Name - - - - - {{ student.nickname }} - {{ student.first_name }} - {{ student.last_name }} - - - - - - -
\ No newline at end of file diff --git a/client/imports/ui/pages/course/userlist.ts b/client/imports/ui/pages/course/userlist.ts deleted file mode 100644 index 6127febb..00000000 --- a/client/imports/ui/pages/course/userlist.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Meteor Imports - import { Meteor } from 'meteor/meteor'; - import { Mongo } from 'meteor/mongo'; -// Angular Imports - import { Component } from '@angular/core'; - -// Angular Meteor Imports - import { MeteorComponent } from 'angular2-meteor'; - -// Define UserList Component -@Component({ - selector: 'tuxlab-userlist', - templateUrl: '/client/imports/ui/pages/course/userlist.html', - directives: [] -}) - -export class UserList extends MeteorComponent { - students: Array; - constructor() { - super(); - this.students = [ - { id: 1, nickname: "sandershihacker", first_name: "Sander", last_name: "Shi" }, - { id: 2, nickname: "derekbro", first_name: "Derek", last_name: "Brown" }, - { id: 3, nickname: "amortenson", first_name: "Aaron", last_name: "Mortenson" }, - { id: 4, nickname: "cersoz", first_name: "Cem", last_name: "Ersoz" }, - ]; - } -} \ No newline at end of file From 352e1760d545b0addfa270deed08d25ee44cf8eb Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 15:36:25 -0400 Subject: [PATCH 067/102] input --- client/imports/ui/pages/course/course_dashboard.html | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 7b097e9a..87cfb821 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -71,6 +71,7 @@
+
diff --git a/package.json b/package.json index 2099a174..2d1c2552 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@angular2-material/checkbox": "2.0.0-alpha.5-3", "@angular2-material/core": "2.0.0-alpha.5-2", "@angular2-material/icon": "2.0.0-alpha.5-2", - "@angular2-material/input": "^2.0.0-alpha.5-3", + "@angular2-material/input": "2.0.0-alpha.5-3", "@angular2-material/progress-bar": "2.0.0-alpha.5-3", "@angular2-material/progress-circle": "2.0.0-alpha.5-3", "@angular2-material/radio": "2.0.0-alpha.5-3", From 4064822f7d785f3c1391e28e7bf8b0b0e2a2e998 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 15:54:27 -0400 Subject: [PATCH 068/102] delete userlist --- .../ui/components/userlist/userlist.html | 7 --- .../ui/components/userlist/userlist.ts | 53 ------------------- 2 files changed, 60 deletions(-) delete mode 100644 client/imports/ui/components/userlist/userlist.html delete mode 100644 client/imports/ui/components/userlist/userlist.ts diff --git a/client/imports/ui/components/userlist/userlist.html b/client/imports/ui/components/userlist/userlist.html deleted file mode 100644 index 0fb1f492..00000000 --- a/client/imports/ui/components/userlist/userlist.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - -

Course Number User List

-
-
-
\ No newline at end of file diff --git a/client/imports/ui/components/userlist/userlist.ts b/client/imports/ui/components/userlist/userlist.ts deleted file mode 100644 index 4ef7a3d2..00000000 --- a/client/imports/ui/components/userlist/userlist.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Meteor Imports - import { Meteor } from 'meteor/meteor'; - import { Mongo } from 'meteor/mongo'; - import 'reflect-metadata'; - import 'zone.js/dist/zone'; - -// Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; - import { bootstrap } from 'angular2-meteor-auto-bootstrap'; - import { APP_BASE_HREF } from '@angular/common'; - import { HTTP_PROVIDERS } from '@angular/http'; - import { InjectUser } from 'angular2-meteor-accounts-ui'; - -// Angular Material Imports - import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; - import { MeteorComponent } from 'angular2-meteor'; - -// Icon - import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; - -// Course Records Import - import { course_records } from '../../../../../collections/course_records.ts'; - -// Define UserList Component - @Component({ - selector: 'tuxlab-userlist', - templateUrl: '/client/imports/ui/components/userlist/userlist.html', - directives: [ - MATERIAL_DIRECTIVES, - MD_ICON_DIRECTIVES], - viewProviders: [ MdIconRegistry ], - encapsulation: ViewEncapsulation.None - }) - -// Export UserList Class - export class UserList extends MeteorComponent { - user: Meteor.User; - courseId: String; - userIds: Array; - constructor(mdIconRegistry: MdIconRegistry) { - super(); - // Create Icon Font - mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); - mdIconRegistry.setDefaultFontSetClass('tuxicon'); - - this.subscribe('course-records', this.courseId, () => { - let courseRecords = course_records.find({ course_id: this.courseId }); - this.userIds = courseRecords.map(function(record) { - return (record).user_id; - }); - }, true); - } - } From ef07f72247ba9b5207c9237694fbcc9de14086f2 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 22 Jul 2016 17:54:41 -0400 Subject: [PATCH 069/102] publish for global admin --- collections/courses.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/collections/courses.ts b/collections/courses.ts index 742510fd..c6d86be6 100644 --- a/collections/courses.ts +++ b/collections/courses.ts @@ -185,11 +185,15 @@ courses.allow({ // Publish All Courses TODO: add pagination Meteor.publish('explore-courses', function(){ this.autorun(function(computation) { - return courses.find({ - "permissions.meta": true, - "featured": true - }, { - }); + if (Roles.isGlobalAdministrator(this.userId)) { + return courses.find(); + } + else { + return courses.find({ + "permissions.meta": true, + "featured": true + }); + } }); }); From 808f61b31c0b0f5d84173c897763046de53aa846 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Mon, 25 Jul 2016 15:14:57 -0400 Subject: [PATCH 070/102] Fixed router params --- client/imports/ui/pages/course/course_dashboard.html | 3 +++ client/imports/ui/pages/course/course_dashboard.ts | 10 ++++------ client/imports/ui/routes/routes.ts | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 87cfb821..28c19b60 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -62,6 +62,8 @@ + + \ No newline at end of file diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 3876a171..26668330 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -10,7 +10,7 @@ import { APP_BASE_HREF, FORM_DIRECTIVES } from '@angular/common'; import { HTTP_PROVIDERS } from '@angular/http'; import { InjectUser } from 'angular2-meteor-accounts-ui'; - import { ROUTER_DIRECTIVES, ActivatedRoute } from '@angular/router'; + import { ROUTER_DIRECTIVES, ActivatedRoute, Router, RouterState } from '@angular/router'; // Angular Material Imports import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; @@ -52,11 +52,8 @@ declare var Collections: any; courseDescription: String = ""; courseName: String = ""; - constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) { + constructor(private route: ActivatedRoute, private router: Router) { super(); - // Create Icon Font - mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); - mdIconRegistry.setDefaultFontSetClass('tuxicon'); // Subscribe to courses database and set current course this.subscribe('user-courses', this.courseId, () => { this.course = Collections.courses.findOne({ _id: this.courseId }); @@ -67,6 +64,7 @@ declare var Collections: any; }, true); } ngOnInit() { - this.courseId = ((this.route.snapshot.params)).courseid; + this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid']; + console.log(this.courseId); } } \ No newline at end of file diff --git a/client/imports/ui/routes/routes.ts b/client/imports/ui/routes/routes.ts index 3b4028d2..5c2c692b 100644 --- a/client/imports/ui/routes/routes.ts +++ b/client/imports/ui/routes/routes.ts @@ -21,10 +21,10 @@ import { provideRouter, RouterConfig } from '@angular/router'; // Explore import Explore from '../pages/explore/explore.ts'; - import Terms from '../pages/static/terms.ts'; // Static import Privacy from '../pages/static/privacy.ts'; + import Terms from '../pages/static/terms.ts'; /* ROUTES */ const routes : RouterConfig = [ From 2cce591a4371f1e8846cbb178d7c451a31f06add Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Mon, 25 Jul 2016 16:07:52 -0400 Subject: [PATCH 071/102] Issue 161 fixed: instructor field in courses --- .../ui/components/explore/explore.html | 5 ++++- .../imports/ui/components/explore/search.html | 8 ++++++-- client/imports/ui/pages/course/course.ts | 2 +- client/style/explore/_explore.scss | 3 +++ collections/README.md | 11 ++++++++++- collections/courses.ts | 19 ++++++++++--------- server/imports/course/search.ts | 2 +- 7 files changed, 35 insertions(+), 15 deletions(-) diff --git a/client/imports/ui/components/explore/explore.html b/client/imports/ui/components/explore/explore.html index 2ad52922..ce5545fc 100644 --- a/client/imports/ui/components/explore/explore.html +++ b/client/imports/ui/components/explore/explore.html @@ -7,7 +7,10 @@ diff --git a/client/imports/ui/components/explore/search.html b/client/imports/ui/components/explore/search.html index b49f7df1..0fb5c570 100644 --- a/client/imports/ui/components/explore/search.html +++ b/client/imports/ui/components/explore/search.html @@ -32,7 +32,8 @@

Search Results for '{{ searchQuery }}'

- Enroll + Enroll + View diff --git a/client/style/account/_login.scss b/client/style/account/_login.scss index f6c65176..793eed5c 100644 --- a/client/style/account/_login.scss +++ b/client/style/account/_login.scss @@ -29,7 +29,7 @@ .google-login-button{ margin:0 auto !important; - + cursor: pointer; display: flex; flex-direction: row; justify-content: flex-start; diff --git a/server/imports/course/search.ts b/server/imports/course/search.ts index b3f754ea..266d2b61 100644 --- a/server/imports/course/search.ts +++ b/server/imports/course/search.ts @@ -29,7 +29,8 @@ export function course_search(text : string, results_per_page : number, page_no "course_number" : 1, "course_name" : 1, "instructors" : 1, - "course_description" : 1 + "course_description" : 1, + "permissions" : 1 } }; async.parallel( From e01b199f65a70d3158e662253c540b3f6c25f993 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Tue, 26 Jul 2016 12:58:50 -0400 Subject: [PATCH 080/102] TaskView -> LabView --- .../ui/pages/lab/{taskview.html => labview.html} | 6 +++--- .../imports/ui/pages/lab/{taskview.ts => labview.ts} | 10 +++++----- client/imports/ui/routes/routes.ts | 4 ++-- client/style/lab/_labview.scss | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) rename client/imports/ui/pages/lab/{taskview.html => labview.html} (95%) rename client/imports/ui/pages/lab/{taskview.ts => labview.ts} (95%) diff --git a/client/imports/ui/pages/lab/taskview.html b/client/imports/ui/pages/lab/labview.html similarity index 95% rename from client/imports/ui/pages/lab/taskview.html rename to client/imports/ui/pages/lab/labview.html index aeb2f1d8..fce3ca09 100644 --- a/client/imports/ui/pages/lab/taskview.html +++ b/client/imports/ui/pages/lab/labview.html @@ -1,7 +1,7 @@ -
+
-
+
@@ -61,7 +61,7 @@
-
+
diff --git a/client/imports/ui/pages/lab/taskview.ts b/client/imports/ui/pages/lab/labview.ts similarity index 95% rename from client/imports/ui/pages/lab/taskview.ts rename to client/imports/ui/pages/lab/labview.ts index c2395e5d..d26242a7 100644 --- a/client/imports/ui/pages/lab/taskview.ts +++ b/client/imports/ui/pages/lab/labview.ts @@ -28,11 +28,11 @@ // Meteor method imports import "../../../lab/methods.ts" -// Define TaskView Component - + +// Define LabView Component @Component({ - selector: 'tuxlab-taskview', - templateUrl: '/client/imports/ui/pages/lab/taskview.html', + selector: 'tuxlab-labview', + templateUrl: '/client/imports/ui/pages/lab/labview.html', directives: [ MarkdownView, Terminal, @@ -49,7 +49,7 @@ }) @InjectUser('user') -export default class TaskView extends MeteorComponent { +export default class LabView extends MeteorComponent { user: Meteor.User; public auth : any; labMarkdown: string; diff --git a/client/imports/ui/routes/routes.ts b/client/imports/ui/routes/routes.ts index df81e9aa..d606ad7b 100644 --- a/client/imports/ui/routes/routes.ts +++ b/client/imports/ui/routes/routes.ts @@ -12,7 +12,7 @@ import { provideRouter, RouterConfig } from '@angular/router'; import Err404 from '../pages/error/404.ts' // Lab - import TaskView from '../pages/lab/taskview.ts'; + import LabView from '../pages/lab/labview.ts'; import LabCreate from '../pages/lab/labcreate.ts' // Course @@ -39,7 +39,7 @@ const routes : RouterConfig = [ { path: 'login', component: Login }, { path: 'terms', component: Terms }, { path: 'privacy', component: Privacy }, - { path: 'lab-view', component: TaskView }, + { path: 'lab-view', component: LabView }, { path: 'lab-create', component: LabCreate }, { path: 'explore', component: Explore }, { path: 'courses', component: CourseList }, diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index dc511802..9f4f5bd9 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -1,9 +1,9 @@ -.tuxlab-taskview { +.tuxlab-labview { display: flex; flex-direction: row; flex-wrap: nowrap; - .tuxlab-taskview-terminal{ + .tuxlab-labview-terminal{ height: 100vh; width: 50%; @@ -52,7 +52,7 @@ /** Markdown **/ - .tuxlab-taskview-step{ + .tuxlab-labview-step{ width: 50%; md-sidenav-layout { height: 100vh; From 085f8af2bee4257ba1b462fef79c7c2482e8ad42 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Tue, 26 Jul 2016 16:42:42 -0400 Subject: [PATCH 081/102] Fixed Gradelist, Lablist and styling issues --- .../ui/pages/course/course_dashboard.html | 21 +----- .../ui/pages/course/course_dashboard.ts | 1 - client/imports/ui/pages/course/gradelist.ts | 47 ++++++++----- client/imports/ui/pages/course/lablist.html | 2 +- client/imports/ui/pages/course/lablist.ts | 69 ++++++++++--------- client/imports/ui/pages/lab/labview.html | 2 +- client/imports/ui/pages/lab/labview.ts | 11 ++- client/style/lab/_labview.scss | 4 +- 8 files changed, 77 insertions(+), 80 deletions(-) diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 28c19b60..47ba20c3 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -1,4 +1,4 @@ -
+
@@ -61,23 +61,4 @@ - - - -
\ No newline at end of file diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 26668330..7afb0b14 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -65,6 +65,5 @@ declare var Collections: any; } ngOnInit() { this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid']; - console.log(this.courseId); } } \ No newline at end of file diff --git a/client/imports/ui/pages/course/gradelist.ts b/client/imports/ui/pages/course/gradelist.ts index 36b988c8..263d60b7 100644 --- a/client/imports/ui/pages/course/gradelist.ts +++ b/client/imports/ui/pages/course/gradelist.ts @@ -5,7 +5,7 @@ // Angular Imports import { Component } from '@angular/core'; - import { ActivatedRoute } from '@angular/router'; + import { ActivatedRoute, Router } from '@angular/router'; declare var Collections: any; @@ -24,9 +24,11 @@ export class GradeList extends MeteorComponent{ grades: Array = []; cur_user: boolean; - constructor(private route: ActivatedRoute) { + constructor(private route: ActivatedRoute, private router: Router) { super(); - this.courseRecord = this.getCourseRecords(); + } + + setGrade() { if (this.courseRecord !== undefined) { let labs = this.courseRecord.labs; let totalEarned = 0; @@ -36,50 +38,57 @@ export class GradeList extends MeteorComponent{ let tasks = lab.tasks; for (let j = 0; j < tasks.length; j++) { let task = tasks[j]; - totalEarned += task.grade.earned; - totalFull += task.grade.total; + totalEarned += task.grade[0]; + totalFull += task.grade[1]; this.grades.push({ 'name': 'lab ' + (i + 1).toString() + ' task ' + (j + 1).toString(), - 'grade': ((task.grade.earned * 100.0) / task.grade.total).toString() + '%' + 'grade': ((task.grade[0] * 100.0) / task.grade[1]).toString() + '%' }); } } + let courseAverage; + if (totalFull !== 0) { + courseAverage = ((totalEarned * 100.0) / totalFull).toString() + "%"; + } + else { + courseAverage = "N/A"; + } this.grades.push({ 'name': 'Course Average', - 'grade': ((totalEarned * 100.0) / totalFull).toString() + '%' + 'grade': courseAverage }); - } - + } } - + getCourseRecords(){ - var record; if(this.cur_user) { // Student - this.subscribe('course-records', [this.courseId, Meteor.userId()], () => { - record = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() }); + this.subscribe('course-records', () => { + this.courseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() }); + this.setGrade(); }, true); - return record; } else{ - var record; this.subscribe('course-records', [this.courseId, this.userId], () => { var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId }); if (localCourseRecord === null || typeof localCourseRecord === "undefined") { // Admin - record = Meteor.call('getUserCourseRecord', this.courseId, this.userId); + this.courseRecord = Meteor.call('getUserCourseRecord', this.courseId, this.userId); + this.setGrade(); } else { // Instructor - record = localCourseRecord; + this.courseRecord = localCourseRecord; + this.setGrade(); } }, true); - return record; } } ngOnInit(){ - this.userId = this.route.snapshot.params['userid']; + this.userId = this.router.routerState.parent(this.route).snapshot.params['userid']; + this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid']; this.cur_user = (typeof this.userId === "undefined" || this.userId === null); + this.getCourseRecords(); } } \ No newline at end of file diff --git a/client/imports/ui/pages/course/lablist.html b/client/imports/ui/pages/course/lablist.html index d0021cae..4aefa67f 100644 --- a/client/imports/ui/pages/course/lablist.html +++ b/client/imports/ui/pages/course/lablist.html @@ -16,7 +16,7 @@ - + {{ lab.name }} {{ lab.completed }} {{ lab.date }} diff --git a/client/imports/ui/pages/course/lablist.ts b/client/imports/ui/pages/course/lablist.ts index 77a9bb35..001a4682 100644 --- a/client/imports/ui/pages/course/lablist.ts +++ b/client/imports/ui/pages/course/lablist.ts @@ -4,7 +4,7 @@ // Angular Imports import { Component } from '@angular/core'; - import { ROUTER_DIRECTIVES, ActivatedRoute } from '@angular/router'; + import { ROUTER_DIRECTIVES, ActivatedRoute, Router } from '@angular/router'; // Angular Material Imports import { MATERIAL_DIRECTIVES, MATERIAL_PROVIDERS } from 'ng2-material'; @@ -14,10 +14,8 @@ import { MeteorComponent } from 'angular2-meteor'; import { InjectUser } from 'angular2-meteor-accounts-ui'; -// Import Collections - import { course_records } from '../../../../../collections/course_records.ts'; - -declare var Collections: any; +// Declare Collections + declare var Collections: any; // Inject current user into class @InjectUser("user") @@ -45,9 +43,36 @@ declare var Collections: any; // Progress Bar Value public determinateValue: number = 0; - constructor(private route: ActivatedRoute) { + constructor(private route: ActivatedRoute, private router: Router) { super(); - this.courseRecord = this.getCourseRecords(); + } + + getCourseRecords(){ + if(this.cur_user) { + // Student + this.subscribe('course-records', () => { + this.courseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() }); + this.setLabs(); + }, true); + } + else{ + this.subscribe('course-records', () => { + var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId }); + if (localCourseRecord === null || typeof localCourseRecord === "undefined") { + // Admin + this.courseRecord = Meteor.call('getUserCourseRecord', this.courseId, this.userId); + this.setLabs(); + } + else { + // Instructor + this.courseRecord = localCourseRecord; + this.setLabs(); + } + }, true); + } + } + + setLabs() { if(typeof this.courseRecord !== "undefined") { let labs = this.courseRecord.labs; let totalCompleted = 0; @@ -63,6 +88,7 @@ declare var Collections: any; } } this.labs.push({ + 'id': lab._id, 'name': 'Lab ' + (i + 1).toString(), 'completed': tasksCompleted.toString() + '/' + tasks.length.toString(), 'date': 'soon' @@ -73,35 +99,12 @@ declare var Collections: any; this.determinateValue = (totalCompleted * 100.0) / totalNumTasks; } } - getCourseRecords(){ - var record; - if(this.cur_user) { - // Student - this.subscribe('course-records', [this.courseId, Meteor.userId()], () => { - record = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() }); - }, true); - return record; - } - else{ - var record; - this.subscribe('course-records', [this.courseId, this.userId], () => { - var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId }); - if (localCourseRecord === null || typeof localCourseRecord === "undefined") { - // Admin - record = Meteor.call('getUserCourseRecord', this.courseId, this.userId); - } - else { - // Instructor - record = localCourseRecord; - } - }, true); - return record; - } - } ngOnInit(){ - this.userId = this.route.snapshot.params['userid']; + this.userId = this.router.routerState.parent(this.route).snapshot.params['userid']; + this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid']; this.cur_user = (typeof this.userId === "undefined" || this.userId === null); + this.getCourseRecords(); } } \ No newline at end of file diff --git a/client/imports/ui/pages/lab/labview.html b/client/imports/ui/pages/lab/labview.html index fce3ca09..669c72d8 100644 --- a/client/imports/ui/pages/lab/labview.html +++ b/client/imports/ui/pages/lab/labview.html @@ -5,7 +5,7 @@ - Course Page + Course Page LabVM Connection {{ task.name }} diff --git a/client/imports/ui/pages/lab/labview.ts b/client/imports/ui/pages/lab/labview.ts index d26242a7..945aaca9 100644 --- a/client/imports/ui/pages/lab/labview.ts +++ b/client/imports/ui/pages/lab/labview.ts @@ -5,9 +5,9 @@ import 'zone.js/dist/zone'; // Angular Imports - import { ViewChild, Component, ViewEncapsulation, provide, Input } from '@angular/core'; + import { ViewChild, Component, ViewEncapsulation, provide, Input, OnInit } from '@angular/core'; import { bootstrap } from 'angular2-meteor-auto-bootstrap'; - import { ROUTER_DIRECTIVES } from '@angular/router'; + import { ROUTER_DIRECTIVES, ActivatedRoute, Router } from '@angular/router'; // Angular Material Imports import { MeteorComponent } from 'angular2-meteor'; @@ -64,7 +64,7 @@ export default class LabView extends MeteorComponent { @ViewChild(Terminal) term : Terminal; - constructor() { + constructor(private route: ActivatedRoute, private router: Router) { super(); this.taskUpdates = []; this.nextButton = false; @@ -76,6 +76,7 @@ export default class LabView extends MeteorComponent { { id: 5, name: "Task 5", completed: true, md: "# Task 5" }, { id: 6, name: "Task 6", completed: false, md: "# Task 6" }, ]; + document.getElementById('course-content').style.maxWidth = "100%"; } ngAfterViewInit(){ @@ -140,5 +141,9 @@ export default class LabView extends MeteorComponent { this.currentTask = task.id; this.currentCompleted = task.completed; } + + ngOnInit() { + this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid']; + } } diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index 9f4f5bd9..f1a3a4e1 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -41,10 +41,10 @@ } @media screen and (max-width: 800px) { - .tuxlab-taskview-terminal { + .tuxlab-labview-terminal { width: 100%; } - .tuxlab-taskview-step { + .tuxlab-labview-step { display: none; } } From 4dc3afc75c21f494097feb6bc2c85cbe3a02a797 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Tue, 26 Jul 2016 17:24:31 -0400 Subject: [PATCH 082/102] Issue #162 Completed --- .../ui/components/markdown/markdown.html | 6 ++++- .../ui/components/markdown/markdown.ts | 3 ++- client/imports/ui/pages/lab/labview.html | 2 +- client/imports/ui/pages/lab/labview.ts | 26 +++++++++++++++++++ client/style/lab/_labview.scss | 9 +++++-- 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/client/imports/ui/components/markdown/markdown.html b/client/imports/ui/components/markdown/markdown.html index 1c4d6fd8..01f87e8b 100644 --- a/client/imports/ui/components/markdown/markdown.html +++ b/client/imports/ui/components/markdown/markdown.html @@ -2,5 +2,9 @@
-
+
+
+

Task Feedback:

+
+
diff --git a/client/imports/ui/components/markdown/markdown.ts b/client/imports/ui/components/markdown/markdown.ts index 668e2cd4..37b37852 100644 --- a/client/imports/ui/components/markdown/markdown.ts +++ b/client/imports/ui/components/markdown/markdown.ts @@ -48,6 +48,7 @@ // Export MarkdownView Class export class MarkdownView extends MeteorComponent{ @Input() mdData = ""; + @Input() mdDataUpdate = ""; constructor(mdIconRegistry: MdIconRegistry) { super(); @@ -58,7 +59,7 @@ export class MarkdownView extends MeteorComponent{ } convert(markdown: string) { let md = marked.setOptions({}); - if(typeof markdown !== "undefined") { + if(typeof markdown !== "undefined" && markdown !== null) { return md.parse(markdown); } else { diff --git a/client/imports/ui/pages/lab/labview.html b/client/imports/ui/pages/lab/labview.html index 669c72d8..06037825 100644 --- a/client/imports/ui/pages/lab/labview.html +++ b/client/imports/ui/pages/lab/labview.html @@ -42,7 +42,7 @@
- Task markdown loading... + Task markdown loading...
-
+
+ + + + Syllabus + + + + Data + + + Submit + + +
diff --git a/client/imports/ui/pages/dashboard/dashboard.html b/client/imports/ui/pages/dashboard/dashboard.html index cbfb9487..bc4d5d51 100644 --- a/client/imports/ui/pages/dashboard/dashboard.html +++ b/client/imports/ui/pages/dashboard/dashboard.html @@ -63,5 +63,12 @@
- Welcome to TuxLab Message + + +

Welcome to TuxLab!

+
+ + + +
diff --git a/collections/courses.ts b/collections/courses.ts index fef91cd7..c89764c2 100644 --- a/collections/courses.ts +++ b/collections/courses.ts @@ -186,7 +186,6 @@ courses.allow({ // Publish All Courses TODO: add pagination Meteor.publish('explore-courses', function(){ this.autorun(function(computation) { - console.log('aga'); if (Roles.isGlobalAdministrator(this.userId)) { return courses.find(); } From ef1486d9090a858668adb7af660c686b756c0228 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 28 Jul 2016 15:02:13 -0400 Subject: [PATCH 089/102] markdown editor for labview --- .../imports/ui/components/lablist/lablist.ts | 95 ------------------- .../ui/components/markdown/markdown.html | 9 +- .../ui/components/markdown/markdown.ts | 55 +++++++++-- .../ui/components/mdeditor/mdeditor.html | 2 +- .../ui/components/mdeditor/mdeditor.ts | 14 ++- client/imports/ui/pages/course/course.html | 4 +- .../ui/pages/course/course_dashboard.html | 2 +- client/imports/ui/pages/lab/labview.ts | 12 +-- client/style/lab/_labview.scss | 17 +++- public/assets | 2 +- tsconfig.json | 29 +++--- 11 files changed, 111 insertions(+), 130 deletions(-) delete mode 100644 client/imports/ui/components/lablist/lablist.ts diff --git a/client/imports/ui/components/lablist/lablist.ts b/client/imports/ui/components/lablist/lablist.ts deleted file mode 100644 index 09265a52..00000000 --- a/client/imports/ui/components/lablist/lablist.ts +++ /dev/null @@ -1,95 +0,0 @@ -// Meteor Imports - import { Meteor } from 'meteor/meteor'; - import { Mongo } from 'meteor/mongo'; - import 'reflect-metadata'; - import 'zone.js/dist/zone'; - -// Angular Imports - import { Component, ViewEncapsulation, provide } from '@angular/core'; - import { bootstrap } from 'angular2-meteor-auto-bootstrap'; - import { APP_BASE_HREF } from '@angular/common'; - import { HTTP_PROVIDERS } from '@angular/http'; - import { InjectUser } from 'angular2-meteor-accounts-ui'; - -// Angular Material Imports - import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; - import { MeteorComponent } from 'angular2-meteor'; - import { MdProgressBar } from '@angular2-material/progress-bar'; - -// Icon - import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; - -// course_record database imports - import { course_records } from '../../../../../collections/course_records.ts'; - -@InjectUser("user") - -// Define LabList Component - @Component({ - selector: 'tuxlab-lablist', - templateUrl: '/client/imports/ui/components/lablist/lablist.html', - directives: [MATERIAL_DIRECTIVES, - MD_ICON_DIRECTIVES, - MdProgressBar], - viewProviders: [MdIconRegistry], - encapsulation: ViewEncapsulation.None - }) - -// Export LabList Class - export class LabList extends MeteorComponent { - user: Meteor.User; - courseId: string; // TODO: Get from URL - userId: string = Meteor.userId(); - labs: Array = []; - courseRecord; - - // Progress Bar Value - public determinateValue: number = 30; - - constructor(mdIconRegistry: MdIconRegistry) { - super(); - // Create Icon Font - mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); - mdIconRegistry.setDefaultFontSetClass('tuxicon'); - - this.setLab(this.courseId, this.userId); - } - - // Method to subscribe to course_records database and set Lab data - setLab(courseId: String, userId: String) { - this.subscribe('course-records', [courseId, userId], () => { - this.courseRecord = course_records.findOne({ course_id: courseId }); - if(typeof this.courseRecord !== "undefined") { - let labs = this.courseRecord.labs; - let totalCompleted = 0; - let totalNumTasks = 0; - for (let i = 0; i < labs.length; i++) { - let lab = labs[i]; - let tasksCompleted = 0; - let tasks = lab.tasks; - for (let j = 0; j < tasks.length; j++) { - let task = tasks[j]; - if (task.status === 'COMPLETED') { - tasksCompleted++; - } - } - this.labs.push({ - 'name': 'Lab ' + (i + 1).toString(), - 'completed': tasksCompleted.toString() + '/' + tasks.length.toString(), - 'date': 'soon' - }); - totalCompleted += tasksCompleted; - totalNumTasks += tasks.length; - } - this.determinateValue = (totalCompleted * 100.0) / totalNumTasks; - } - }, true); - } - - // Link to lab function - toLab(lab) { - console.log("Redirecting to " + lab + "page."); - window.location.href = "/lab"; - } - } - diff --git a/client/imports/ui/components/markdown/markdown.html b/client/imports/ui/components/markdown/markdown.html index 01f87e8b..68029f29 100644 --- a/client/imports/ui/components/markdown/markdown.html +++ b/client/imports/ui/components/markdown/markdown.html @@ -1,7 +1,14 @@
-
+ + + +
+
+ + +

Task Feedback:

diff --git a/client/imports/ui/components/markdown/markdown.ts b/client/imports/ui/components/markdown/markdown.ts index 37b37852..c9754c55 100644 --- a/client/imports/ui/components/markdown/markdown.ts +++ b/client/imports/ui/components/markdown/markdown.ts @@ -5,11 +5,12 @@ import 'zone.js/dist/zone'; // Angular Imports - import { Component, ViewEncapsulation, provide, Input } from '@angular/core'; + import { Component, ViewEncapsulation, provide, Input, OnInit } from '@angular/core'; import { bootstrap } from 'angular2-meteor-auto-bootstrap'; import { APP_BASE_HREF } from '@angular/common'; import { HTTP_PROVIDERS } from '@angular/http'; import { InjectUser } from 'angular2-meteor-accounts-ui'; + import { ActivatedRoute, Router } from '@angular/router'; // Angular Material Imports import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material'; @@ -23,6 +24,14 @@ // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; + +// MDEditor + import { MDEditor } from '../mdeditor/mdeditor.ts'; + +// Roles + import { Roles } from '../../../../../collections/users.ts'; + +declare var Collections: any; // Markdown Imports /// @@ -37,7 +46,8 @@ MD_TOOLBAR_DIRECTIVES, MD_ICON_DIRECTIVES, MD_INPUT_DIRECTIVES, - MD_SIDENAV_DIRECTIVES + MD_SIDENAV_DIRECTIVES, + MDEditor ], viewProviders: [ MdIconRegistry ], @@ -49,12 +59,12 @@ export class MarkdownView extends MeteorComponent{ @Input() mdData = ""; @Input() mdDataUpdate = ""; + courseId: string; + labId: string; + showMDE: boolean = false; - constructor(mdIconRegistry: MdIconRegistry) { + constructor(private route: ActivatedRoute, private router: Router) { super(); - // Create Icon Font - mdIconRegistry.registerFontClassAlias('tux', 'tuxicon'); - mdIconRegistry.setDefaultFontSetClass('tuxicon'); } convert(markdown: string) { @@ -66,4 +76,35 @@ export class MarkdownView extends MeteorComponent{ return ""; } } -} + ngOnInit() { + this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid']; + this.labId = this.route.snapshot.params['labid']; + } + isInstruct() { + if(typeof this.courseId !== "undefined") { + return Roles.isInstructorFor(this.courseId); + } + else { + return false; + } + } + // Toggle to show either markdown editor or task markdown + mdeToggle() { + this.showMDE = !this.showMDE; + } + + // Update new markdown + updateMarkdown() { + Collections.labs.update({ + _id: this.labId + }, { + $set: { + // Set current task markdown + } + }); + } + // Output event from MDE + mdUpdated(md: string) { + this.mdData = md; + } +} \ No newline at end of file diff --git a/client/imports/ui/components/mdeditor/mdeditor.html b/client/imports/ui/components/mdeditor/mdeditor.html index 24684698..2199e210 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.html +++ b/client/imports/ui/components/mdeditor/mdeditor.html @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/client/imports/ui/components/mdeditor/mdeditor.ts b/client/imports/ui/components/mdeditor/mdeditor.ts index cf6a6240..b337f786 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.ts +++ b/client/imports/ui/components/mdeditor/mdeditor.ts @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor'; // Angular Imports - import { Component, ElementRef, ViewChild } from '@angular/core'; + import { Component, ElementRef, ViewChild, Input, Output, EventEmitter } from '@angular/core'; // Angular Material Imports import { MeteorComponent } from 'angular2-meteor'; @@ -19,15 +19,23 @@ // Export Editor Class export class MDEditor extends MeteorComponent { @ViewChild('simplemde') textarea : ElementRef; + @Input() mdData: string = ""; + @Output() mdUpdated = new EventEmitter(); constructor(private elementRef:ElementRef) { super(); } 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/course/course.html b/client/imports/ui/pages/course/course.html index 35751ce4..b5f2b45e 100644 --- a/client/imports/ui/pages/course/course.html +++ b/client/imports/ui/pages/course/course.html @@ -6,7 +6,7 @@ @@ -15,7 +15,7 @@ diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index e7e99c13..c006bac8 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -95,7 +95,7 @@
-
+
diff --git a/client/imports/ui/pages/lab/labview.ts b/client/imports/ui/pages/lab/labview.ts index 073b044c..22a72b04 100644 --- a/client/imports/ui/pages/lab/labview.ts +++ b/client/imports/ui/pages/lab/labview.ts @@ -52,7 +52,7 @@ export default class LabView extends MeteorComponent { user: Meteor.User; public auth : any; - labMarkdown: string; + labMarkdown: string = "# This is a markdown string \n ## So is this."; updateMarkdown: string; taskName: string = "Task Name Here"; labProgress: string = "3 / 10"; @@ -102,11 +102,11 @@ export default class LabView extends MeteorComponent { } else{ if(res.verified){ - slf.nextButton = true; - } - else{ - slf.nextButton = false; - } + slf.nextButton = true; + } + else{ + slf.nextButton = false; + } slf.taskUpdates = res.taskUpdates; } }); diff --git a/client/style/lab/_labview.scss b/client/style/lab/_labview.scss index 5c30b138..b00c7066 100644 --- a/client/style/lab/_labview.scss +++ b/client/style/lab/_labview.scss @@ -153,9 +153,11 @@ //Markdown Content .markdown-content { - padding: 40px; + padding: 20px; background-color: #fcfcfc; + text-align: right; #task-markdown { + text-align: left; code { background-color: #dfdfdf; padding: 4px; @@ -165,6 +167,19 @@ margin-top: 18px; } } + #task-editor { + text-align: left; + } + a { + cursor: pointer; + md-icon { + color: #666666; + line-height: 0; + } + .tuxicon-edit:before { + font-size: 36px; + } + } } #feedback-markdown { margin: 25px; 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/tsconfig.json b/tsconfig.json index 18a33a18..c839a68b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,36 +22,41 @@ "node_modules" ], "files": [ - "client/imports/course/methods.ts", "client/imports/lab/methods.ts", "client/imports/ui/components/explore/explore.ts", "client/imports/ui/components/explore/search.ts", - "client/imports/ui/components/gradelist/gradelist.ts", - "client/imports/ui/components/lablist/lablist.ts", - "client/imports/ui/components/loadscreen/loadscreen.ts", "client/imports/ui/components/markdown/markdown.ts", "client/imports/ui/components/markdown/marked.d.ts", "client/imports/ui/components/mdeditor/mdeditor.ts", - "client/imports/ui/components/userlist/userlist.ts", "client/imports/ui/components/wetty/terminal.ts", "client/imports/ui/pages/account/account.ts", "client/imports/ui/pages/account/login.ts", - "client/imports/ui/pages/course/course.routes.ts", + "client/imports/ui/pages/course/course_dashboard.ts", "client/imports/ui/pages/course/course.ts", + "client/imports/ui/pages/course/gradelist.ts", "client/imports/ui/pages/course/gradeview.ts", - "client/imports/ui/pages/course/labview.ts", - "client/imports/ui/pages/course/mainview.ts", + "client/imports/ui/pages/course/lablist.ts", + "client/imports/ui/pages/course/studentlist.ts", + "client/imports/ui/pages/courselist/courselist.ts", "client/imports/ui/pages/dashboard/dashboard.ts", - "client/imports/ui/pages/error/404.ts", + "client/imports/ui/pages/error/error.ts", "client/imports/ui/pages/explore/explore.ts", - "client/imports/ui/pages/instructor/instructor.ts", - "client/imports/ui/pages/lab/taskview.ts", + "client/imports/ui/pages/lab/labcreate.ts", + "client/imports/ui/pages/lab/labview.ts", "client/imports/ui/pages/static/privacy.ts", "client/imports/ui/pages/static/terms.ts", - "client/routes.ts", + "client/imports/ui/routes/course.guard.course.ts", + "client/imports/ui/routes/course.guard.lab.ts", + "client/imports/ui/routes/course.guard.record.ts", + "client/imports/ui/routes/course.routes.ts", + "client/imports/ui/routes/guard.auth.ts", + "client/imports/ui/routes/routes.ts", "client/tuxlab.ts", + "server/imports/api/lab.session.d.ts", "server/imports/course/methods.ts", + "server/imports/course/search.ts", "server/imports/lab/checkLab.d.ts", + "server/imports/lab/labMethods.ts", "server/imports/lab/methods.ts", "typings/globals/es6-shim/index.d.ts", "typings/globals/meteor/index.d.ts", From f67e079ad17e658d8a0a94cc6ebceb007c2729b9 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 28 Jul 2016 15:07:34 -0400 Subject: [PATCH 090/102] . --- client/imports/ui/components/mdeditor/mdeditor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/imports/ui/components/mdeditor/mdeditor.html b/client/imports/ui/components/mdeditor/mdeditor.html index 2199e210..24684698 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.html +++ b/client/imports/ui/components/mdeditor/mdeditor.html @@ -1,2 +1,2 @@ - \ No newline at end of file + From 4c7074004ba29e35f2720e993310dad19ffec8bd Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 28 Jul 2016 15:10:34 -0400 Subject: [PATCH 091/102] . --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aaae1c0c..2d1c2552 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@angular2-material/button": "2.0.0-alpha.5-3", "@angular2-material/card": "2.0.0-alpha.5-3", "@angular2-material/checkbox": "2.0.0-alpha.5-3", - "@angular2-material/core": "2.0.0-alpha.5-2", + "@angular2-material/core": "2.0.0-alpha.5-2", "@angular2-material/icon": "2.0.0-alpha.5-2", "@angular2-material/input": "2.0.0-alpha.5-3", "@angular2-material/progress-bar": "2.0.0-alpha.5-3", From 36538a7cab31819987a66853287ccedb957af6d9 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 28 Jul 2016 15:12:09 -0400 Subject: [PATCH 092/102] remove test --- client/imports/ui/pages/lab/labview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/imports/ui/pages/lab/labview.ts b/client/imports/ui/pages/lab/labview.ts index 22a72b04..76adf103 100644 --- a/client/imports/ui/pages/lab/labview.ts +++ b/client/imports/ui/pages/lab/labview.ts @@ -52,7 +52,7 @@ export default class LabView extends MeteorComponent { user: Meteor.User; public auth : any; - labMarkdown: string = "# This is a markdown string \n ## So is this."; + labMarkdown: string; updateMarkdown: string; taskName: string = "Task Name Here"; labProgress: string = "3 / 10"; From 283a8509153a7f12e8c468d982eae05eddc8b850 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 28 Jul 2016 17:31:51 -0400 Subject: [PATCH 093/102] Syllabus update on course_dashboard for instructors works --- client/imports/ui/pages/course/course.ts | 4 ---- .../ui/pages/course/course_dashboard.html | 5 +++-- .../ui/pages/course/course_dashboard.ts | 18 ++++++++++++++++++ collections/courses.ts | 4 ++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/client/imports/ui/pages/course/course.ts b/client/imports/ui/pages/course/course.ts index 1ef391df..025e35fe 100644 --- a/client/imports/ui/pages/course/course.ts +++ b/client/imports/ui/pages/course/course.ts @@ -44,7 +44,6 @@ export default class CourseView extends MeteorComponent { courseId: string; courseNumber: string = ""; - isInstructor: boolean = false; user: Meteor.User; constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) { super(); @@ -59,9 +58,6 @@ } ngOnInit() { this.courseId = ((this.route.snapshot.params)).courseid; - if(typeof this.courseId !== "undefined") { - this.isInstructor = Roles.isInstructorFor(this.courseId); - } } isInstruct() { if(typeof this.courseId !== "undefined") { diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index c006bac8..23deea4f 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -85,10 +85,11 @@ - Data + {{courseSyllabus}} + - Submit + Submit
diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 7625f248..c1791e42 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -28,6 +28,9 @@ // Roles Import import { Roles } from '../../../../../collections/users.ts'; +// Markdown Editor + import { MDEditor } from '../../components/mdeditor/mdeditor.ts'; + declare var Collections: any; // Define CourseDashboard Component @@ -41,6 +44,7 @@ declare var Collections: any; FORM_DIRECTIVES, MD_INPUT_DIRECTIVES, LabList, + MDEditor, GradeList ], viewProviders: [MdIconRegistry], @@ -54,6 +58,7 @@ declare var Collections: any; courseId: string; courseDescription: string = ""; courseName: string = ""; + courseSyllabus: string = ""; constructor(private route: ActivatedRoute, private router: Router) { super(); @@ -63,6 +68,7 @@ declare var Collections: any; if (typeof this.course !== "undefined") { this.courseName = this.course.course_name; this.courseDescription = this.course.course_description.content; + this.courseSyllabus = this.course.course_description.syllabus; } }, true); } @@ -77,4 +83,16 @@ declare var Collections: any; return false; } } + mdUpdate(md: string) { + this.courseSyllabus = md; + } + updateSyllabus() { + Collections.courses.update({ + _id: this.courseId + }, { + $set: { + "course_description.syllabus": this.courseSyllabus + } + }); + } } diff --git a/collections/courses.ts b/collections/courses.ts index c89764c2..7895eb77 100644 --- a/collections/courses.ts +++ b/collections/courses.ts @@ -17,7 +17,7 @@ courses.allow({ return Roles.isGlobalAdministrator(userId); }, update: function (userId, doc : any, fields : any) { - if(fields.contains('featured')){ + if(fields.indexOf('featured') >= 0){ return Roles.isAdministratorFor(userId); } else{ @@ -200,4 +200,4 @@ courses.allow({ //TODO @sander Publish Course Based on Route }); - } + } \ No newline at end of file From 4423616b7380ba2bcb416a7fda11c2d6e6e5176e Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Thu, 28 Jul 2016 18:06:02 -0400 Subject: [PATCH 094/102] onChange detect for mdeditor --- .../ui/components/mdeditor/mdeditor.ts | 22 ++++++++++++------- .../ui/pages/course/course_dashboard.html | 1 - 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client/imports/ui/components/mdeditor/mdeditor.ts b/client/imports/ui/components/mdeditor/mdeditor.ts index b337f786..4cad38df 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.ts +++ b/client/imports/ui/components/mdeditor/mdeditor.ts @@ -2,9 +2,9 @@ import { Meteor } from 'meteor/meteor'; // Angular Imports - import { Component, ElementRef, ViewChild, Input, Output, EventEmitter } from '@angular/core'; + import { Component, ElementRef, ViewChild, Input, Output, EventEmitter, OnChanges } from '@angular/core'; -// Angular Material Imports +// Angular Meteor Imports import { MeteorComponent } from 'angular2-meteor'; // Declare Global Variable @@ -17,11 +17,11 @@ }) // Export Editor Class - export class MDEditor extends MeteorComponent { + export class MDEditor extends MeteorComponent implements OnChanges { @ViewChild('simplemde') textarea : ElementRef; @Input() mdData: string = ""; @Output() mdUpdated = new EventEmitter(); - + public mde; constructor(private elementRef:ElementRef) { super(); } @@ -29,13 +29,19 @@ ngAfterViewInit(){ var self = this; // Instantiate SimpleMDE - var mde = new SimpleMDE({ element: this.elementRef.nativeElement.value }); + this.mde = new SimpleMDE({ element: this.elementRef.nativeElement.value }); // Read initial data from task markdown - mde.value(self.mdData); + this.mde.value(self.mdData); // Catch changes - mde.codemirror.on("change", function() { - self.mdData = mde.value(); + this.mde.codemirror.on("change", function() { + self.mdData = self.mde.value(); self.mdUpdated.emit(self.mdData); }); } + ngOnChanges(changes) { + if(typeof this.mde !== "undefined") { + this.mde.value(changes['mdData'].currentValue); + } + } + } diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 23deea4f..7d632efe 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -85,7 +85,6 @@ - {{courseSyllabus}} From eb1ab70a759c18b12abe282a8e0f6676418c937f Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 29 Jul 2016 11:56:18 -0400 Subject: [PATCH 095/102] fixed reversed md text editor --- .../ui/components/explore/explore.html | 2 +- .../imports/ui/components/explore/explore.ts | 8 ++-- .../ui/components/mdeditor/mdeditor.ts | 37 ++++++++++--------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/client/imports/ui/components/explore/explore.html b/client/imports/ui/components/explore/explore.html index df92a4e8..a40ccfb2 100644 --- a/client/imports/ui/components/explore/explore.html +++ b/client/imports/ui/components/explore/explore.html @@ -1,6 +1,6 @@
- + diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index 18caf200..64f075e7 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -22,8 +22,8 @@ // Icon import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon'; -// Courses Imports - import { courses } from '../../../../../collections/courses.ts'; +// Collections + declare var Collections: any; // Define ExploreView Component @Component({ @@ -44,7 +44,7 @@ // Export ExploreView Class export class ExploreView extends MeteorComponent { - courses: Array = []; + exploreCourses: Array = []; constructor(mdIconRegistry: MdIconRegistry) { super(); @@ -53,7 +53,7 @@ export class ExploreView extends MeteorComponent { mdIconRegistry.setDefaultFontSetClass('tuxicon'); this.subscribe('explore-courses', () => { - this.courses = courses.find().fetch(); + this.exploreCourses = Collections.courses.find({ "featured": true }).fetch(); }, true); } } diff --git a/client/imports/ui/components/mdeditor/mdeditor.ts b/client/imports/ui/components/mdeditor/mdeditor.ts index 4cad38df..ce610abb 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.ts +++ b/client/imports/ui/components/mdeditor/mdeditor.ts @@ -22,26 +22,29 @@ @Input() mdData: string = ""; @Output() mdUpdated = new EventEmitter(); public mde; + readMDE: boolean = false; 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) { - if(typeof this.mde !== "undefined") { - this.mde.value(changes['mdData'].currentValue); - } - } + 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; + } + } } From 7571d1c18fbac1b0bf2aea061ec1c04e3614d695 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 29 Jul 2016 14:48:51 -0400 Subject: [PATCH 096/102] Disable links to non-accessible tasks for students --- client/imports/ui/components/markdown/markdown.html | 2 +- client/imports/ui/pages/lab/labview.html | 10 ++++------ client/style/lab/_labview.scss | 7 ++----- server/imports/course/search.ts | 1 + 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/client/imports/ui/components/markdown/markdown.html b/client/imports/ui/components/markdown/markdown.html index 68029f29..133fc0e2 100644 --- a/client/imports/ui/components/markdown/markdown.html +++ b/client/imports/ui/components/markdown/markdown.html @@ -14,4 +14,4 @@

Task Feedback:

- + \ No newline at end of file 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/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/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+"'"}, From 4f78e53b72e86fc3a44d3932d4cf6f15bfe03fe4 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 29 Jul 2016 16:55:25 -0400 Subject: [PATCH 097/102] Fixed merge issues --- .../imports/ui/components/explore/explore.ts | 6 +++++- client/imports/ui/components/explore/search.ts | 10 ++++++++-- client/imports/ui/pages/account/account.ts | 18 +++++++++++------- .../ui/pages/course/course_dashboard.html | 12 +++++++++--- .../ui/pages/course/course_dashboard.ts | 9 +++++++++ client/imports/ui/pages/explore/explore.ts | 4 ++++ client/imports/ui/pages/lab/labview.ts | 4 ++++ 7 files changed, 50 insertions(+), 13 deletions(-) diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index 2b08659c..c8ad567a 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -3,10 +3,12 @@ // Angular Imports 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 { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; // Collections declare var Collections: any; @@ -16,7 +18,9 @@ selector: 'tuxlab-exploreview', templateUrl: '/client/imports/ui/components/explore/explore.html', directives: [ - MATERIAL_DIRECTIVES + MATERIAL_DIRECTIVES, + ROUTER_DIRECTIVES, + MD_TABS_DIRECTIVES ], }) 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/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_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 7d632efe..c6b9f619 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -61,7 +61,7 @@
-
+
@@ -85,10 +85,16 @@ - +
+ +
+
+ {{ 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 e717d8ce..6b2d4554 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -21,6 +21,9 @@ // Markdown Editor import { MDEditor } from '../../components/mdeditor/mdeditor.ts'; + +// Icon + import { MD_ICON_DIRECTIVES } from '@angular2-material/icon'; declare var Collections: any; @@ -32,6 +35,7 @@ declare var Collections: any; ROUTER_DIRECTIVES, MATERIAL_DIRECTIVES, MD_INPUT_DIRECTIVES, + MD_ICON_DIRECTIVES, LabList, MDEditor, GradeList @@ -46,6 +50,7 @@ declare var Collections: any; courseDescription: string = ""; courseName: string = ""; courseSyllabus: string = ""; + editSyllabus: boolean = false; constructor(private route: ActivatedRoute, private router: Router) { super(); @@ -82,5 +87,9 @@ declare var Collections: any; "course_description.syllabus": this.courseSyllabus } }); + this.toggleEdit(); + } + toggleEdit() { + this.editSyllabus = !this.editSyllabus; } } diff --git a/client/imports/ui/pages/explore/explore.ts b/client/imports/ui/pages/explore/explore.ts index 843de3a0..99c9ceec 100644 --- a/client/imports/ui/pages/explore/explore.ts +++ b/client/imports/ui/pages/explore/explore.ts @@ -19,6 +19,9 @@ // Component View Imports 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({ @@ -30,6 +33,7 @@ MD_TABS_DIRECTIVES, MD_INPUT_DIRECTIVES, FORM_DIRECTIVES, + MD_ICON_DIRECTIVES, MdToolbar, ExploreView, SearchView 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 From 18fcb1a376a96a5cc8f3699332ac669760c2d161 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Fri, 29 Jul 2016 17:18:38 -0400 Subject: [PATCH 098/102] markdown on explore --- .../ui/components/explore/explore.html | 4 +--- .../imports/ui/components/explore/explore.ts | 14 +++++++++++++ .../ui/pages/course/course_dashboard.html | 4 +--- .../ui/pages/course/course_dashboard.ts | 20 +++++++++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/client/imports/ui/components/explore/explore.html b/client/imports/ui/components/explore/explore.html index a40ccfb2..f1a3fe25 100644 --- a/client/imports/ui/components/explore/explore.html +++ b/client/imports/ui/components/explore/explore.html @@ -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 c8ad567a..55313f15 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -12,6 +12,9 @@ // Collections declare var Collections: any; + +/// + import * as marked from 'marked'; // Define ExploreView Component @Component({ @@ -36,4 +39,15 @@ export class ExploreView extends MeteorComponent { 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/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index c6b9f619..41d67630 100644 --- a/client/imports/ui/pages/course/course_dashboard.html +++ b/client/imports/ui/pages/course/course_dashboard.html @@ -88,9 +88,7 @@
-
- {{ courseSyllabus }} -
+
Submit diff --git a/client/imports/ui/pages/course/course_dashboard.ts b/client/imports/ui/pages/course/course_dashboard.ts index 6b2d4554..d07eb938 100644 --- a/client/imports/ui/pages/course/course_dashboard.ts +++ b/client/imports/ui/pages/course/course_dashboard.ts @@ -27,6 +27,9 @@ declare var Collections: any; +/// + import * as marked from 'marked'; + // Define CourseDashboard Component @Component({ selector: 'tuxlab-course-dashboard', @@ -76,9 +79,13 @@ 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 @@ -89,7 +96,20 @@ declare var Collections: any; }); 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 ""; + } + } } From e59696c609a3ba63cc72dfddf10bfb60c198d90a Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Mon, 1 Aug 2016 11:13:45 -0400 Subject: [PATCH 099/102] . --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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", From c22b13936683e920ade0fc45e2163485e17e7c86 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Mon, 1 Aug 2016 11:20:20 -0400 Subject: [PATCH 100/102] indentation --- .../imports/ui/components/explore/explore.ts | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index 55313f15..e44f2f7e 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -1,45 +1,45 @@ // Meteor Imports - import { Meteor } from 'meteor/meteor'; + import { Meteor } from 'meteor/meteor'; // Angular Imports - import { Component } from '@angular/core'; - import { ROUTER_DIRECTIVES } from '@angular/router'; + 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 { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; + import { MATERIAL_DIRECTIVES } from 'ng2-material'; + import { MeteorComponent } from 'angular2-meteor'; + import { MD_TABS_DIRECTIVES } from '@angular2-material/tabs'; // Collections - declare var Collections: any; - + 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, - ROUTER_DIRECTIVES, - MD_TABS_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 { exploreCourses: Array = []; - constructor() { - super(); + constructor() { + super(); + + this.subscribe('explore-courses', () => { + this.exploreCourses = Collections.courses.find({ "featured": true }).fetch(); + }, true); + } - this.subscribe('explore-courses', () => { - this.exploreCourses = Collections.courses.find({ "featured": true }).fetch(); - }, true); - } - // Convert to markdown convert(markdown: string) { let md = marked.setOptions({}); From 09518dcb1115301c0a685e1373c2987e0f2f10b5 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Mon, 1 Aug 2016 11:23:38 -0400 Subject: [PATCH 101/102] indentation --- .../ui/components/mdeditor/mdeditor.ts | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/client/imports/ui/components/mdeditor/mdeditor.ts b/client/imports/ui/components/mdeditor/mdeditor.ts index 5d890d68..8c17ffe6 100644 --- a/client/imports/ui/components/mdeditor/mdeditor.ts +++ b/client/imports/ui/components/mdeditor/mdeditor.ts @@ -1,30 +1,30 @@ // 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, OnChanges } 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 implements OnChanges { - @ViewChild('simplemde') textarea : ElementRef; - @Input() mdData: string = ""; - @Output() mdUpdated = new EventEmitter(); - public mde; + 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; From 32bf2bad92a6b88b9936d9b45d2789b84bd81580 Mon Sep 17 00:00:00 2001 From: Sander Shi Date: Mon, 1 Aug 2016 11:56:35 -0400 Subject: [PATCH 102/102] indentation --- .../imports/ui/components/explore/explore.ts | 2 +- .../ui/components/markdown/markdown.html | 6 ++-- .../ui/components/markdown/markdown.ts | 24 ++++++++++------ .../ui/pages/course/course_dashboard.html | 8 +++--- client/imports/ui/pages/explore/explore.ts | 28 +++++++++---------- 5 files changed, 37 insertions(+), 31 deletions(-) diff --git a/client/imports/ui/components/explore/explore.ts b/client/imports/ui/components/explore/explore.ts index e44f2f7e..298bb154 100644 --- a/client/imports/ui/components/explore/explore.ts +++ b/client/imports/ui/components/explore/explore.ts @@ -30,7 +30,7 @@ // Export ExploreView Class export class ExploreView extends MeteorComponent { - exploreCourses: Array = []; + exploreCourses: Array = []; constructor() { super(); diff --git a/client/imports/ui/components/markdown/markdown.html b/client/imports/ui/components/markdown/markdown.html index 133fc0e2..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:

-
\ No newline at end of file + diff --git a/client/imports/ui/components/markdown/markdown.ts b/client/imports/ui/components/markdown/markdown.ts index cebd6cc0..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,6 +32,7 @@ declare var Collections: any; templateUrl: '/client/imports/ui/components/markdown/markdown.html', directives: [ MATERIAL_DIRECTIVES, + MD_ICON_DIRECTIVES, MDEditor ], }) @@ -37,7 +41,8 @@ declare var Collections: any; export class MarkdownView extends MeteorComponent{ @Input() mdData = ""; @Input() mdDataUpdate = ""; - + @Input() taskid: number; + courseId: string; labId: string; showMDE: boolean = false; @@ -71,18 +76,19 @@ export class MarkdownView extends MeteorComponent{ mdeToggle() { this.showMDE = !this.showMDE; } - - // Update new markdown + + // Update new markdown updateMarkdown() { - Collections.labs.update({ - _id: this.labId - }, { + Collections.labs.update({ + _id: this.labId, + "tasks.id": this.taskid + }, { $set: { - // Set current task markdown - } + "tasks.$.md": this.mdData + } }); } - // Output event from MDE + // Output event from MDE mdUpdated(md: string) { this.mdData = md; } diff --git a/client/imports/ui/pages/course/course_dashboard.html b/client/imports/ui/pages/course/course_dashboard.html index 41d67630..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,7 +59,7 @@
- +
@@ -97,7 +97,7 @@
- +
diff --git a/client/imports/ui/pages/explore/explore.ts b/client/imports/ui/pages/explore/explore.ts index 99c9ceec..583a08b7 100644 --- a/client/imports/ui/pages/explore/explore.ts +++ b/client/imports/ui/pages/explore/explore.ts @@ -1,25 +1,25 @@ // 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'; @@ -29,7 +29,7 @@ templateUrl: '/client/imports/ui/pages/explore/explore.html', directives: [ MATERIAL_DIRECTIVES, - ROUTER_DIRECTIVES, + ROUTER_DIRECTIVES, MD_TABS_DIRECTIVES, MD_INPUT_DIRECTIVES, FORM_DIRECTIVES,