Skip to content

Commit b08bc7d

Browse files
sandershihackerDerekTBrown
authored andcommitted
Schema Validation and Sidenav Fix (#109)
* Updated Schemas * Load Screen * Loading Screen * publish subscribe and dynamic explore page * deleted swap file * publish subscribe * template fixes * added start for reactive publication * template issue * . * . * course_records publish * course_records reactively publish * revert meteor update * publish subscribe and lineheight for searchpage icons * fixed indentation and removed test file * indentation * indentation * Accounts page and fixed random erro * toolbar for mobile devices * toolbar * account.html fixes * Toolbar made responsive * Responsive toolbar fixes * created userlist component * course_records course_id validation * indentation * markdown * import changes * validation addition
1 parent de7be2c commit b08bc7d

File tree

24 files changed

+331
-179
lines changed

24 files changed

+331
-179
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ExploreView extends MeteorComponent {
5050
mdIconRegistry.registerFontClassAlias('tux', 'tuxicon');
5151
mdIconRegistry.setDefaultFontSetClass('tuxicon');
5252

53-
this.subscribe('all-courses', () => {
53+
this.subscribe('explore-courses', () => {
5454
this.courses = courses.find().fetch();
5555
}, true);
5656
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2323

2424
// Courses Database Imports
25-
import { courses } from '../../../../../collections/courses';
25+
import { courses } from '../../../../../collections/courses.ts';
2626

2727
// Define SearchView Component
2828
@Component({

client/imports/ui/components/gradelist/gradelist.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2020

2121
// Course Records Import
22-
import { course_records } from '../../../../../collections/course_records';
22+
import { course_records } from '../../../../../collections/course_records.ts';
2323

2424
@InjectUser("user")
2525

client/imports/ui/components/lablist/lablist.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2121

2222
// course_record database imports
23-
import { course_records } from '../../../../../collections/course_records';
23+
import { course_records } from '../../../../../collections/course_records.ts';
2424

2525
@InjectUser("user")
2626

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<md-icon fontIcon="tuxicon-left"></md-icon>
1010
</a>
1111
</div>
12-
<p class="text-center markdown-task-name">Task Name Here</p>
12+
<p class="text-center markdown-task-name">{{ labName }}</p>
1313
<div>
14-
<p>3/10</p>
14+
<p>{{ labProgress }}</p>
1515
</div>
1616
</div>
1717
</md-toolbar>

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
// Icon
2323
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
24-
24+
25+
import { LabData } from '../../pages/lab/taskview.ts';
2526
// Markdown Imports
2627
/// <reference path="./marked.d.ts" />
2728
import * as marked from 'marked';
@@ -44,18 +45,21 @@
4445

4546
// Export MarkdownView Class
4647
export class MarkdownView {
47-
4848
//TODO: Replace with markdown from the database
49-
data = "# Markdown\n This is a short **markdown** string, and this is *italic* text. Here is some ***bold and italic*** text. \n ## Subtitle here";
50-
convertedData = this.data;
49+
data = (new LabData).labMarkdown;
50+
convertedData: String;
51+
labName = "Lab Name Here";
52+
labProgress = "3/10";
5153

5254
constructor(mdIconRegistry: MdIconRegistry) {
5355
// Create Icon Font
5456
mdIconRegistry.registerFontClassAlias('tux', 'tuxicon');
5557
mdIconRegistry.setDefaultFontSetClass('tuxicon');
56-
58+
5759
// Parse markdown string
5860
let md = marked.setOptions({});
59-
this.convertedData = md.parse(this.data);
61+
if(typeof this.data !== "undefined") {
62+
this.convertedData = md.parse(this.data);
63+
}
6064
}
61-
}
65+
}

client/imports/ui/components/mdeditor/mdeditor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay';
1818

1919
// Toolbar
20-
import { MD_TOOLBAR_DIRECTIVES } from '@angular2-material/toolbar';
21-
import "../../../../../node_modules/@angular2-material/toolbar/toolbar.css";
20+
import { MD_TOOLBAR_DIRECTIVES } from '@angular2-material/toolbar';
2221

2322
// Icon
2423
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="tuxlab-userlist">
2+
<md-card>
3+
<md-card-content>
4+
<h2>Course Number User List</h2>
5+
</md-card-content>
6+
</md-card>
7+
</div>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Meteor Imports
2+
import { Meteor } from 'meteor/meteor';
3+
import { Mongo } from 'meteor/mongo';
4+
import 'reflect-metadata';
5+
import 'zone.js/dist/zone';
6+
7+
// Angular Imports
8+
import { Component, ViewEncapsulation, provide } from '@angular/core';
9+
import { bootstrap } from 'angular2-meteor-auto-bootstrap';
10+
import { APP_BASE_HREF } from '@angular/common';
11+
import { HTTP_PROVIDERS } from '@angular/http';
12+
import { InjectUser } from 'angular2-meteor-accounts-ui';
13+
14+
// Angular Material Imports
15+
import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material';
16+
import { MeteorComponent } from 'angular2-meteor';
17+
18+
// Icon
19+
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
20+
21+
// Course Records Import
22+
import { course_records } from '../../../../../collections/course_records.ts';
23+
24+
// Define UserList Component
25+
@Component({
26+
selector: 'tuxlab-userlist',
27+
templateUrl: '/client/imports/ui/components/userlist/userlist.html',
28+
directives: [
29+
MATERIAL_DIRECTIVES,
30+
MD_ICON_DIRECTIVES],
31+
viewProviders: [ MdIconRegistry ],
32+
encapsulation: ViewEncapsulation.None
33+
})
34+
35+
// Export UserList Class
36+
export class UserList extends MeteorComponent {
37+
user: Meteor.User;
38+
courseId: String;
39+
userIds: Array<String>;
40+
constructor(mdIconRegistry: MdIconRegistry) {
41+
super();
42+
// Create Icon Font
43+
mdIconRegistry.registerFontClassAlias('tux', 'tuxicon');
44+
mdIconRegistry.setDefaultFontSetClass('tuxicon');
45+
46+
this.subscribe('course-records', this.courseId, () => {
47+
let courseRecords = course_records.find({ course_id: this.courseId });
48+
this.userIds = courseRecords.map(function(record) {
49+
return (<any>record).user_id;
50+
});
51+
}, true);
52+
}
53+
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2121

2222
// LabList and Grades import
23-
import { LabList } from "../../components/lablist/lablist";
24-
import { GradeList } from "../../components/gradelist/gradelist";
23+
import { LabList } from "../../components/lablist/lablist.ts";
24+
import { GradeList } from "../../components/gradelist/gradelist.ts";
2525

2626
// Courses and Course Record Imports
27-
import { courses } from "../../../../../collections/courses";
28-
import { course_records } from "../../../../../collections/course_records";
27+
import { courses } from "../../../../../collections/courses.ts";
28+
import { course_records } from "../../../../../collections/course_records.ts";
2929

3030
// Define CourseView Component
3131
@Component({
@@ -56,8 +56,7 @@
5656
mdIconRegistry.setDefaultFontSetClass('tuxicon');
5757

5858
// Display Course Toolbar
59-
document.getElementById('course-toolbar').style.display = "block";
60-
59+
document.getElementById('course-toolbar').className += " block";
6160
// Activate toolbar button
6261
document.getElementById('toolbar-course').className += " active-button";
6362

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2020

2121
// Grades import
22-
import { GradeList } from "../../components/gradelist/gradelist";
22+
import { GradeList } from "../../components/gradelist/gradelist.ts";
2323

2424
// Define GradeView Component
2525
@Component({
@@ -41,11 +41,9 @@
4141
mdIconRegistry.setDefaultFontSetClass('tuxicon');
4242

4343
// Display Course Toolbar
44-
document.getElementById('course-toolbar').style.display = "block";
45-
44+
document.getElementById('course-toolbar').className += "block";
45+
4646
// Activate toolbar button
4747
document.getElementById('toolbar-grades').className += "active-button";
48-
49-
document.getElementById('tux-content').style.marginTop = "20px";
5048
}
5149
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2020

2121
// LabList import
22-
import { LabList } from "../../components/lablist/lablist";
22+
import { LabList } from "../../components/lablist/lablist.ts";
2323

2424
// Define LabsView Component
2525
@Component({
@@ -41,11 +41,9 @@
4141
mdIconRegistry.setDefaultFontSetClass('tuxicon');
4242

4343
// Display Course Toolbar
44-
document.getElementById('course-toolbar').style.display = "block";
45-
44+
document.getElementById('course-toolbar').className += "block";
45+
4646
// Activate toolbar button
4747
document.getElementById('toolbar-labs').className += "active-button";
48-
49-
document.getElementById('tux-content').style.marginTop = "20px";
5048
}
5149
}

client/imports/ui/pages/instructor/instructor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import { MD_ICON_DIRECTIVES, MdIconRegistry } from '@angular2-material/icon';
2121

2222
// Editor Component
23-
import { MDEditor } from '../../components/mdeditor/mdeditor';
23+
import { MDEditor } from '../../components/mdeditor/mdeditor.ts';
2424

25-
import { LoadScreen } from '../../components/loadscreen/loadscreen';
25+
import { LoadScreen } from '../../components/loadscreen/loadscreen.ts';
2626

2727
// Define InstructorView Component
2828
@Component({

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import { MeteorComponent } from 'angular2-meteor';
1313

1414
// Terminal and Markdown Imports
15-
import { Terminal } from "../../components/wetty/terminal";
16-
import { MarkdownView } from "../../components/markdown/markdown";
15+
import { Terminal } from "../../components/wetty/terminal.ts";
16+
import { MarkdownView } from "../../components/markdown/markdown.ts";
1717

1818
// Meteor method imports
1919
// import { create_Lab } from "../../../lab/methods.ts"
@@ -26,11 +26,16 @@
2626
})
2727

2828
export default class TaskView extends MeteorComponent{
29-
29+
3030
constructor() {
3131
super();
3232
//TODO This Doesn't Exist
3333
//Meteor.call('createLab',{courseId: "5",labId: 5},(err,res) => {console.log("fired",err,res)});
3434
}
35-
3635
}
36+
37+
export class LabData {
38+
// TODO: get from database
39+
labMarkdown = "# Lab 1 Tasks \n ### Task 1 \n Implement **bash** *on your own* ***without*** any help. \n ### Task 2 \n Install *Arch Linux*. \n ### Task 3 \n Type ```sudo rm -rf /*``` into your terminal";
40+
constructor() {}
41+
}

client/style/base/_toolbar.scss

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
.tux-toolbar {
2+
md-toolbar {
3+
a {
4+
color:black;
5+
}
6+
}
27
md-toolbar.small {
38
min-height: inherit;
4-
display: none;
59
.mobile-toolbar-buttons {
610
margin: 0 auto;
711
a {
8-
color: black;
912
display: block;
1013
float: left;
1114
height: 64px;
@@ -49,11 +52,8 @@
4952
.tux-toolbar-nav {
5053
white-space:nowrap;
5154
[md-button] {
52-
font-weight: 300;
53-
}
54-
a {
55-
color: black;
56-
}
55+
font-weight: 300;
56+
}
5757
}
5858
.tux-toolbar-login {
5959
a, a:visited {
@@ -100,7 +100,8 @@
100100
// Sub-toolbar
101101
#course-toolbar {
102102
display: none;
103-
md-toolbar {
103+
white-space: nowrap;
104+
md-toolbar.large {
104105
min-height: inherit;
105106
background-color: #f0f0f0;
106107
.wrapper {
@@ -125,6 +126,11 @@
125126
height: 66px;
126127
padding-top: 14px;
127128
line-height: 45px;
129+
background-color: #f0f0f0;
130+
margin: 0;
131+
}
132+
a:hover {
133+
background-color: #dfdfdf;
128134
}
129135
a.home-button, a.home-button:visited {
130136
font-weight: bold;
@@ -141,6 +147,14 @@
141147
}
142148
}
143149
}
150+
md-toolbar.small {
151+
overflow-x: scroll;
152+
overflow-y: hidden;
153+
background-color: #f0f0f0;
154+
a {
155+
color: black;
156+
}
157+
}
144158
}
145159

146160
// Sidenav
@@ -194,7 +208,10 @@
194208
}
195209
}
196210
}
197-
211+
md-sidenav-layout.md-sidenav-opened {
212+
position: fixed;
213+
width: 100%;
214+
}
198215
md-sidenav-layout {
199216
.page-content {
200217
padding: 0;

client/style/course/_courseview.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@
2424
margin-bottom: 30px;
2525
margin-top: 20px;
2626
}
27+
#course-toolbar.block {
28+
display: block;
29+
}

0 commit comments

Comments
 (0)