Skip to content

Commit 6e1078c

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

File tree

9 files changed

+209
-34
lines changed

9 files changed

+209
-34
lines changed

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

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@
33
<md-card>
44
<md-card-title>
55
<md-card-title-text>
6-
<span class="md-headline">
6+
<span class="md-headline" *ngIf="!editMeta">
77
{{ courseName }}
8-
<md-icon fontIcon="tuxicon-cog" *ngIf="isInstruct()"></md-icon>
8+
<md-icon fontIcon="tuxicon-cog" *ngIf="isInstruct()" (click)="toggleMetaEdit()"></md-icon>
9+
</span>
10+
<span class="md-headline" *ngIf="editMeta">
11+
<input type="text" [(ngModel)]="courseName" style="width: 100%">
912
</span>
1013

1114
</md-card-title-text>
1215
</md-card-title>
1316
<md-card-content>
14-
<p [innerHTML]="courseDescription"></p>
17+
<p [innerHTML]="courseDescription" *ngIf="!editMeta"></p>
18+
<textarea *ngIf="editMeta" [(ngModel)]="courseDescription" style="width: 100%; max-width: 100%; min-width: 100%; min-height: 200px;"></textarea>
1519
</md-card-content>
20+
1621
<md-card-actions layout="row" layout-align="end center">
17-
<a md-button href="https://www.cs.cmu.edu/~15131/f15/">Course Website</a>
22+
<a md-button href="https://www.cs.cmu.edu/~15131/f15/" *ngIf="!editMeta">
23+
Course Website
24+
</a>
25+
<button md-button *ngIf="editMeta" (click)="updateMeta()">
26+
Update
27+
</button>
1828
</md-card-actions>
1929
</md-card>
2030

@@ -70,10 +80,41 @@
7080
</md-card-title-text>
7181
</md-card-title>
7282
<md-card-content>
73-
Data
83+
<p>Meta: <span>(show course on Explore page)</span></p>
84+
<div class="radio-group">
85+
selected value: {{ radioMeta }}
86+
<br>
87+
<input type="radio" name="meta" id="radio-meta1" [(ngModel)]="radioMeta" [value]="true">
88+
<label for="radio-meta1"><span></span>True</label>
89+
<input type="radio" name="meta" id="radio-meta2" [(ngModel)]="radioMeta" [value]="false">
90+
<label for="radio-meta2"><span></span>False</label>
91+
</div>
92+
<p>Content: <span>(labs available to)</span></p>
93+
<div class="radio-group">
94+
selected value: {{ radioContent }}
95+
<br>
96+
<input type="radio" name="content" id="radio-content1" [(ngModel)]="radioContent" value="any">
97+
<label for="radio-content1"><span></span>Any</label>
98+
<input type="radio" name="content" id="radio-content2" [(ngModel)]="radioContent" value="auth">
99+
<label for="radio-content2"><span></span>Auth</label>
100+
<input type="radio" name="content" id="radio-content3" [(ngModel)]="radioContent" value="none">
101+
<label for="radio-content3"><span></span>None</label>
102+
</div>
103+
104+
<p>Enroll: <span>(who can enroll)</span></p>
105+
<div class="radio-group">
106+
selected value: {{ radioEnroll }}
107+
<br>
108+
<input type="radio" name="enroll" id="radio-enroll1" value="any" [(ngModel)]="radioEnroll">
109+
<label for="radio-enroll1"><span></span>Any</label>
110+
<input type="radio" name="enroll" id="radio-enroll2" value="none" [(ngModel)]="radioEnroll">
111+
<label for="radio-enroll2"><span></span>None</label>
112+
</div>
113+
74114
</md-card-content>
75115
<md-card-actions layout="row" layout-align="end center">
76-
<a md-button>Submit</a>
116+
<p class="msg">{{ updateMessage }}</p>
117+
<a md-button (click)="updatePerm()">Submit</a>
77118
</md-card-actions>
78119
</md-card>
79120
</div>
@@ -92,7 +133,7 @@
92133
</md-card-content>
93134
<md-card-actions layout="row" layout-align="end center">
94135
<a md-button (click)="updateSyllabus()" *ngIf="editSyllabus">Submit</a>
95-
<a md-button *ngIf="!editSyllabus" (click)="toggleEdit()">Edit</a>
136+
<a md-button *ngIf="!editSyllabus" (click)="toggleSyllabusEdit()">Edit</a>
96137
</md-card-actions>
97138
</md-card>
98139
</div>

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

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay';
1313
import { MD_INPUT_DIRECTIVES } from '@angular2-material/input';
1414

15+
import { FORM_DIRECTIVES } from '@angular/common';
16+
import { MdToolbar } from '@angular2-material/toolbar';
17+
1518
// LabList and Grades import
1619
import { GradeList } from './gradelist.ts';
1720
import { LabList } from './lablist.ts';
@@ -39,6 +42,8 @@ declare var Collections: any;
3942
MATERIAL_DIRECTIVES,
4043
MD_INPUT_DIRECTIVES,
4144
MD_ICON_DIRECTIVES,
45+
FORM_DIRECTIVES,
46+
MdToolbar,
4247
LabList,
4348
MDEditor,
4449
GradeList
@@ -54,18 +59,28 @@ declare var Collections: any;
5459
courseName: string = "";
5560
courseSyllabus: string = "";
5661
editSyllabus: boolean = false;
62+
editMeta: boolean = false;
63+
radioMeta: boolean;
64+
radioContent: string;
65+
radioEnroll: string;
66+
updateMessage: string = "";
5767

5868
constructor(private route: ActivatedRoute, private router: Router) {
5969
super();
6070

6171
// Subscribe to courses database and set current course
6272
this.subscribe('user-courses', this.courseId, () => {
63-
this.course = Collections.courses.findOne({ _id: this.courseId });
64-
if (typeof this.course !== "undefined") {
65-
this.courseName = this.course.course_name;
66-
this.courseDescription = this.course.course_description.content;
67-
this.courseSyllabus = this.course.course_description.syllabus;
68-
}
73+
this.autorun(() => {
74+
this.course = Collections.courses.findOne({ _id: this.courseId });
75+
if (typeof this.course !== "undefined") {
76+
this.courseName = this.course.course_name;
77+
this.courseDescription = this.course.course_description.content;
78+
this.courseSyllabus = this.course.course_description.syllabus;
79+
this.radioMeta = this.course.permissions.meta;
80+
this.radioContent = this.course.permissions.content;
81+
this.radioEnroll = this.course.permissions.enroll;
82+
}
83+
});
6984
}, true);
7085
}
7186
ngOnInit() {
@@ -79,12 +94,12 @@ declare var Collections: any;
7994
return false;
8095
}
8196
}
82-
97+
8398
// Emit function
8499
mdUpdate(md: string) {
85100
this.courseSyllabus = md;
86101
}
87-
102+
88103
// Update the database with new syllabus
89104
updateSyllabus() {
90105
Collections.courses.update({
@@ -94,15 +109,56 @@ declare var Collections: any;
94109
"course_description.syllabus": this.courseSyllabus
95110
}
96111
});
97-
this.toggleEdit();
112+
this.toggleSyllabusEdit();
113+
}
114+
115+
updatePerm() {
116+
if(typeof this.radioMeta !== "undefined" && typeof this.radioContent !== "undefind" && typeof this.radioMeta !== "undefined") {
117+
Collections.courses.update({
118+
_id: this.courseId
119+
}, {
120+
$set: {
121+
permissions: {
122+
meta: this.radioMeta,
123+
content: this.radioContent,
124+
enroll: this.radioEnroll
125+
}
126+
}
127+
});
128+
this.updateMessage = "Last updated on " + (new Date()).toLocaleTimeString();
129+
}
130+
else {
131+
this.updateMessage = "Error updating: one or more fields are not selected";
132+
}
98133
}
99-
134+
135+
updateMeta() {
136+
if(typeof this.courseDescription !== "undefined") {
137+
Collections.courses.update({
138+
_id: this.courseId
139+
}, {
140+
$set: {
141+
"course_name": this.courseName,
142+
"course_description.content": this.courseDescription
143+
}
144+
});
145+
this.toggleMetaEdit();
146+
}
147+
else {
148+
alert('update fail');
149+
}
150+
}
151+
100152
// Hide and show the markdown editor for syllabus
101-
toggleEdit() {
153+
toggleSyllabusEdit() {
102154
this.editSyllabus = !this.editSyllabus;
103155
}
104-
105-
// Convert to markdown
156+
157+
toggleMetaEdit() {
158+
this.editMeta = !this.editMeta;
159+
}
160+
161+
// Convert to markdown
106162
convert(markdown: string) {
107163
let md = marked.setOptions({});
108164
if(typeof markdown !== "undefined" && markdown !== null) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
super();
4747
}
4848

49-
getCourseRecords(){
49+
getCourseRecords() {
50+
// Get from course_records
5051
this.subscribe('course-records', () => {
5152
this.autorun(() => {
5253
if(this.cur_user) {
@@ -70,7 +71,7 @@
7071
}
7172

7273
setLabs() {
73-
if(typeof this.courseRecord !== "undefined") {
74+
if(typeof this.courseRecord !== "undefined" && this.courseRecord !== null) {
7475
let labs = this.courseRecord.labs;
7576
let totalCompleted = 0;
7677
let totalNumTasks = 0;

client/imports/ui/pages/lab/labcreate.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="tuxlab-labcreate-upload">
33
<h1> UPLOAD LAB </h1>
44
<div class="form-group">
5-
<input name="name" type="text" class="form-control" required [(ngModel)]="lab.name" placeholder="Lab Name" />
5+
<input name="name" type="text" class="form-control" required [(ngModel)]="lab.name" placeholder="Enter Lab Name" />
66
</div>
77
<div class="form-group">
88
<div fileDrop
@@ -16,8 +16,12 @@ <h3> Drop LabFile Here </h3>
1616

1717
</div>
1818
</div>
19-
<div class="form-group">
20-
<button md-raised-button name="verify" class="verify" (click)="upload()"> Upload <md-icon fontIcon="tuxicon-tick"></md-icon> </button>
19+
<div class="form-group upload-button">
20+
<button md-raised-button name="verify" class="verify" (click)="upload()">
21+
Upload
22+
<md-icon fontIcon="tuxicon-tick" *ngIf="uploaded"></md-icon>
23+
<md-icon fontIcon="tuxicon-close" *ngIf="!uploaded"></md-icon>
24+
</button>
2125
</div>
2226
</div>
2327
<div class="tuxlab-labcreate-verify" *ngIf="uploaded">

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import { MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES } from 'ng2-material';
1111
import { MeteorComponent } from 'angular2-meteor';
1212
import { FileDropDirective } from 'angular2-file-drop';
13+
import { MD_ICON_DIRECTIVES } from '@angular2-material/icon';
1314

1415
// Global Variables Declaration
1516
declare var Collections: any;
@@ -22,7 +23,8 @@
2223
FileDropDirective,
2324
ROUTER_DIRECTIVES,
2425
FORM_DIRECTIVES,
25-
MATERIAL_DIRECTIVES
26+
MATERIAL_DIRECTIVES,
27+
MD_ICON_DIRECTIVES
2628
],
2729
providers: [
2830
FORM_PROVIDERS,

client/style/course/_courseview.scss

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
width: 100%;
103103
margin: 0 auto;
104104
max-width: $tuxlab-max-width;
105-
105+
106106
md-data-table {
107107
tr {
108108
cursor: pointer;
@@ -133,5 +133,45 @@
133133
}
134134
}
135135
}
136+
md-card-content {
137+
p {
138+
span {
139+
color: #afafaf;
140+
}
141+
}
142+
.radio-group {
143+
margin-left: 20px;
144+
padding: 10px;
145+
input[type=radio] {
146+
display: none;
147+
}
148+
input[type=radio] + label {
149+
color: black;
150+
font-size: 14px;
151+
}
152+
input[type=radio] + label span {
153+
display: inline-block;;
154+
width: 19px;
155+
height: 19px;
156+
vertical-align: middle;;
157+
cursor: pointer;;
158+
border-radius: 50%;
159+
-moz-border-radius: 50%;
160+
margin: 10px;
161+
border: solid 4px #f1c40f;
162+
}
163+
input[type=radio] + label span {
164+
background-color: transparent;
165+
}
166+
input[type=radio]:checked + label span {
167+
background-color: #ffd600;
168+
}
169+
}
170+
}
171+
md-card-actions {
172+
.msg {
173+
color: #999999;
174+
}
175+
}
136176
}
137-
}
177+
}

client/style/lab/_labcreate.scss

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,46 @@
1515
.tuxlab-labcreate-upload{
1616
display: block;
1717
max-width:400px;
18+
h1 {
19+
font-weight: 400;
20+
text-align: center;
21+
}
22+
23+
.upload-button {
24+
text-align: center;
25+
margin: 15px;
26+
button {
27+
md-icon {
28+
line-height: 15px;
29+
&::before {
30+
font-size: 36px;
31+
}
32+
}
33+
.tuxicon-close {
34+
color: red;
35+
}
36+
.tuxicon-tick {
37+
color: green;
38+
}
39+
}
40+
}
1841

1942
input[name=name]{
2043
width:100%;
2144

22-
font-size:24px;
45+
font-size:20px;
46+
font-weight: 400;
47+
font-family: "Open Sans";
48+
text-align: center;
2349

2450
box-sizing: border-box;
2551
padding:5px 10px;
2652
border: none;
53+
border-bottom: solid 2px #afafaf;
54+
}
55+
56+
input[name=name]:focus {
57+
outline: none;
2758
}
2859

2960
div[fileDrop]{

0 commit comments

Comments
 (0)