Skip to content

Commit f744c04

Browse files
sandershihackerDerekTBrown
authored andcommitted
TaskView toolbar color darken
remove tests Combine Subscriptions Reactive Subscription for CourseList and GradeList instructor view of course dashboard Dashboard not logged in
1 parent c6b8051 commit f744c04

File tree

13 files changed

+168
-90
lines changed

13 files changed

+168
-90
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<div class="wrapper">
66
<!-- Navigation -->
77
<div class="course-toolbar-nav">
8-
<a md-button [routerLink]="['/course/' + courseId]" class="home-button">Home</a>
9-
<a md-button [routerLink]="['/course/' + courseId + '/labs']">Labs</a>
10-
<a md-button [routerLink]="['/course/' + courseId + '/grades']">Grades</a>
11-
<a md-button [routerLink]="['/course/' + courseId]">Settings</a>
8+
<a md-button [routerLink]="['/course/' + courseId]" class="home-button">{{ courseNumber }} Home</a>
9+
<a md-button [routerLink]="['/course/' + courseId + '/labs']" *ngIf="isInstruct()">Labs</a>
10+
<a md-button [routerLink]="['/course/' + courseId + '/grades']" *ngIf="!isInstruct()">Grades</a>
11+
<a md-button [routerLink]="['/course/' + courseId]" *ngIf="isInstruct()">Students</a>
1212
</div>
1313
</div>
1414
</md-toolbar>
1515
<md-toolbar class="small" *showItBootstrap="['xs']">
1616
<div>
17-
<a md-button [routerLink]="['/course/' + courseId]">Home</a>
18-
<a md-button [routerLink]="['/course/' + courseId + '/labs']">Labs</a>
19-
<a md-button [routerLink]="['/course/' + courseId + '/grades']">Grades</a>
20-
<a md-button [routerLink]="['/course/' + courseId]">Settings</a>
17+
<a md-button [routerLink]="['/course/' + courseId]">{{ courseNumber }} Home</a>
18+
<a md-button [routerLink]="['/course/' + courseId + '/labs']" *ngIf="isInstruct()">Labs</a>
19+
<a md-button [routerLink]="['/course/' + courseId + '/grades']" *ngIf="!isInstruct()">Grades</a>
20+
<a md-button [routerLink]="['/course/' + courseId]" *ngIf="isInstruct()">Students</a>
2121
</div>
2222
<md-icon fontIcon="tuxicon-right"></md-icon>
2323
</md-toolbar>

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
// Icon
2121
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
22+
23+
// Roles
24+
import { Roles } from '../../../../../collections/users.ts';
2225

2326
declare var Collections: any;
2427

@@ -40,14 +43,33 @@
4043
// Export CourseView Class
4144
export default class CourseView extends MeteorComponent {
4245
courseId: string;
46+
courseNumber: string = "";
47+
isInstructor: boolean = false;
4348
user: Meteor.User;
4449
constructor(mdIconRegistry: MdIconRegistry, private route: ActivatedRoute) {
4550
super();
4651
// Create Icon Font
4752
mdIconRegistry.registerFontClassAlias('tux', 'tuxicon');
4853
mdIconRegistry.setDefaultFontSetClass('tuxicon');
54+
this.subscribe('user-courses', () => {
55+
this.autorun(() => {
56+
this.courseNumber = Collections.courses.findOne({ _id: this.courseId }).course_number;
57+
});
58+
}, true);
4959
}
5060
ngOnInit() {
5161
this.courseId = (<any>(this.route.snapshot.params)).courseid;
62+
if(typeof this.courseId !== "undefined") {
63+
this.isInstructor = Roles.isInstructorFor(this.courseId);
64+
}
65+
}
66+
isInstruct() {
67+
if(typeof this.courseId !== "undefined") {
68+
return Roles.isInstructorFor(this.courseId);
69+
}
70+
else {
71+
return false;
72+
}
5273
}
5374
}
75+

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

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
<md-card>
44
<md-card-title>
55
<md-card-title-text>
6-
<span class="md-headline">{{ courseName }}</span>
6+
<span class="md-headline">
7+
{{ courseName }}
8+
<md-icon fontIcon="tuxicon-cog" *ngIf="isInstruct()"></md-icon>
9+
</span>
10+
711
</md-card-title-text>
812
</md-card-title>
913
<md-card-content>
@@ -15,13 +19,11 @@
1519
</md-card>
1620

1721
<!-- Responsive Section for Grades and Assignments -->
18-
<div layout="row" layout-xs="column">
19-
22+
<div layout="row" layout-xs="column" *ngIf="!isInstruct()">
2023
<!-- Grade List -->
2124
<div flex>
2225
<tuxlab-gradelist></tuxlab-gradelist>
2326
</div>
24-
2527
<!-- Announcements -->
2628
<div flex>
2729
<md-card>
@@ -56,9 +58,44 @@
5658
</md-card-content>
5759
</md-card>
5860
</div>
59-
61+
</div>
62+
63+
<!-- Permissions Section -->
64+
<div layout="row" *ngIf="isInstruct()">
65+
<div flex>
66+
<md-card>
67+
<md-card-title>
68+
<md-card-title-text>
69+
<span class="md-headline">Permissions</span>
70+
</md-card-title-text>
71+
</md-card-title>
72+
<md-card-content>
73+
Data
74+
</md-card-content>
75+
<md-card-actions layout="row" layout-align="end center">
76+
<a md-button>Submit</a>
77+
</md-card-actions>
78+
</md-card>
79+
</div>
80+
<div flex>
81+
<md-card>
82+
<md-card-title>
83+
<md-card-title-text>
84+
<span class="md-headline">Syllabus</span>
85+
</md-card-title-text>
86+
</md-card-title>
87+
<md-card-content>
88+
Data
89+
</md-card-content>
90+
<md-card-actions layout="row" layout-align="end center">
91+
<a md-button>Submit</a>
92+
</md-card-actions>
93+
</md-card>
94+
</div>
6095
</div>
6196

6297
<!--Lab List Card-->
63-
<tuxlab-lablist></tuxlab-lablist>
98+
<div *ngIf="!isInstruct()">
99+
<tuxlab-lablist></tuxlab-lablist>
100+
</div>
64101
</div>

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
// LabList and Grades import
2525
import { GradeList } from './gradelist.ts';
2626
import { LabList } from './lablist.ts';
27+
28+
// Roles Import
29+
import { Roles } from '../../../../../collections/users.ts';
2730

2831
declare var Collections: any;
2932

@@ -41,16 +44,16 @@ declare var Collections: any;
4144
GradeList
4245
],
4346
viewProviders: [MdIconRegistry],
44-
providers: [OVERLAY_PROVIDERS],
47+
providers: [ OVERLAY_PROVIDERS ],
4548
encapsulation: ViewEncapsulation.None
4649
})
4750

4851
// Export CourseDashboard Class
4952
export class CourseDashboard extends MeteorComponent {
5053
course;
5154
courseId: string;
52-
courseDescription: String = "";
53-
courseName: String = "";
55+
courseDescription: string = "";
56+
courseName: string = "";
5457

5558
constructor(private route: ActivatedRoute, private router: Router) {
5659
super();
@@ -66,4 +69,12 @@ declare var Collections: any;
6669
ngOnInit() {
6770
this.courseId = this.router.routerState.parent(this.route).snapshot.params['courseid'];
6871
}
72+
isInstruct() {
73+
if (typeof this.courseId !== "undefined") {
74+
return Roles.isInstructorFor(this.courseId);
75+
}
76+
else {
77+
return false;
78+
}
79+
}
6980
}

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

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class GradeList extends MeteorComponent{
2828
super();
2929
}
3030

31-
setGrade() {
31+
setGrades() {
3232
if (this.courseRecord !== undefined) {
3333
let labs = this.courseRecord.labs;
3434
let totalEarned = 0;
@@ -61,28 +61,26 @@ export class GradeList extends MeteorComponent{
6161
}
6262

6363
getCourseRecords(){
64-
if(this.cur_user) {
65-
// Student
66-
this.subscribe('course-records', () => {
67-
this.courseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() });
68-
this.setGrade();
69-
}, true);
70-
}
71-
else{
72-
this.subscribe('course-records', [this.courseId, this.userId], () => {
73-
var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId });
74-
if (localCourseRecord === null || typeof localCourseRecord === "undefined") {
75-
// Admin
76-
this.courseRecord = Meteor.call('getUserCourseRecord', this.courseId, this.userId);
77-
this.setGrade();
64+
this.subscribe('course-records', () => {
65+
this.autorun(() => {
66+
if(this.cur_user) {
67+
// Student
68+
this.courseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() });
7869
}
7970
else {
80-
// Instructor
81-
this.courseRecord = localCourseRecord;
82-
this.setGrade();
71+
var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId });
72+
if(localCourseRecord === null || typeof localCourseRecord === "undefined") {
73+
// Admin
74+
this.courseRecord = Meteor.call('getUserCourseRecord', this.courseId, this.userId);
75+
}
76+
else {
77+
// Instructor
78+
this.courseRecord = localCourseRecord;
79+
}
8380
}
84-
}, true);
85-
}
81+
this.setGrades();
82+
});
83+
}, true);
8684
}
8785

8886
ngOnInit(){

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

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,27 @@
4747
super();
4848
}
4949

50-
getCourseRecords(){
51-
if(this.cur_user) {
52-
// Student
53-
this.subscribe('course-records', () => {
54-
this.courseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() });
55-
this.setLabs();
56-
}, true);
57-
}
58-
else{
59-
this.subscribe('course-records', () => {
60-
var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId });
61-
if (localCourseRecord === null || typeof localCourseRecord === "undefined") {
62-
// Admin
63-
this.courseRecord = Meteor.call('getUserCourseRecord', this.courseId, this.userId);
64-
this.setLabs();
50+
getCourseRecords(){
51+
this.subscribe('course-records', () => {
52+
this.autorun(() => {
53+
if(this.cur_user) {
54+
// Student
55+
this.courseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: Meteor.userId() });
6556
}
6657
else {
67-
// Instructor
68-
this.courseRecord = localCourseRecord;
69-
this.setLabs();
58+
var localCourseRecord = Collections.course_records.findOne({ course_id: this.courseId, user_id: this.userId });
59+
if(localCourseRecord === null || typeof localCourseRecord === "undefined") {
60+
// Admin
61+
this.courseRecord = Meteor.call('getUserCourseRecord', this.courseId, this.userId);
62+
}
63+
else {
64+
// Instructor
65+
this.courseRecord = localCourseRecord;
66+
}
7067
}
71-
}, true);
72-
}
68+
this.setLabs();
69+
});
70+
}, true);
7371
}
7472

7573
setLabs() {

client/imports/ui/pages/dashboard/dashboard.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,12 @@
6363

6464
<!-- Non-Logged In Dashboard -->
6565
<div class="tuxlab-dashboard" *ngIf="!user">
66-
Welcome to TuxLab Message
66+
<md-card>
67+
<md-card-title>
68+
<h1>Welcome to TuxLab!</h1>
69+
</md-card-title>
70+
<md-card-content>
71+
72+
</md-card-content>
73+
</md-card>
6774
</div>

client/imports/ui/pages/lab/labview.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ export default class LabView extends MeteorComponent {
5656
updateMarkdown: string;
5757
taskName: string = "Task Name Here";
5858
labProgress: string = "3 / 10";
59-
tasks: Array<any>;
59+
tasks: Array<any> = [];
6060
currentTask: number;
6161
currentCompleted: boolean;
6262
courseId: string;
6363
nextButton : boolean;
64-
taskUpdates : Array<string>
64+
taskUpdates : Array<string> = [];
6565
@ViewChild(Terminal) term : Terminal;
6666

6767

@@ -70,25 +70,6 @@ export default class LabView extends MeteorComponent {
7070
this.taskUpdates = [];
7171
this.nextButton = false;
7272

73-
// Tests
74-
this.tasks = [
75-
{ id: 1, name: "Task 1", completed: true, md: "# Task 1" },
76-
{ id: 2, name: "Task 2", completed: true, md: "# Task 2" },
77-
{ id: 3, name: "Task 3", completed: true, md: "# Task 3" },
78-
{ id: 4, name: "Task 4", completed: false, md: "# Task 4" },
79-
{ id: 5, name: "Task 5", completed: true, md: "# Task 5" },
80-
{ id: 6, name: "Task 6", completed: false, md: "# Task 6" },
81-
];
82-
this.taskUpdates = [
83-
"## Feedback 1",
84-
"## Feedback 2",
85-
"## Feedback 3",
86-
null,
87-
"## Feedback 5",
88-
null
89-
];
90-
this.joinTaskUpdate();
91-
9273
document.getElementById('course-content').style.maxWidth = "100%";
9374
}
9475

client/style/course/_courseview.scss

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,20 @@
118118
}
119119
}
120120

121-
.course-gradelist {
122-
display: none;
123-
}
124-
.course-lablist {
125-
display: none;
121+
.tuxlab-course-dashboard {
122+
md-card {
123+
md-card-title {
124+
md-card-title-text {
125+
md-icon {
126+
color: #666666;
127+
float: right;
128+
line-height: 0px;
129+
cursor: pointer;
130+
}
131+
.tuxicon-cog:before {
132+
font-size: 36px;
133+
}
134+
}
135+
}
136+
}
126137
}

client/style/lab/_labview.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
.markdown-toolbar{
9898
md-toolbar{
9999
min-height:inherit;
100-
background-color: #f0f0f0;
100+
background-color: #e0e0e0;
101101
.wrapper{
102102
display: flex;
103103
flex-direction: row;

0 commit comments

Comments
 (0)