Skip to content

Commit 942274e

Browse files
authored
Revert "Labfile markdown" (#112)
1 parent 06803b1 commit 942274e

File tree

3 files changed

+17
-35
lines changed

3 files changed

+17
-35
lines changed

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
viewProviders: [ MdIconRegistry ],
3737
encapsulation: ViewEncapsulation.None
3838
})
39-
39+
4040
// Export Explore Class
4141
export class SearchView extends MeteorComponent {
4242

@@ -47,29 +47,30 @@ export class SearchView extends MeteorComponent {
4747
totalItems: this.courses.length
4848
};
4949
pagedCourses: Array<any> = [];
50-
50+
5151
constructor(mdIconRegistry: MdIconRegistry) {
5252
super();
53-
53+
5454
// Create Icon Font
5555
mdIconRegistry.registerFontClassAlias('tux', 'tuxicon');
5656
mdIconRegistry.setDefaultFontSetClass('tuxicon');
57-
58-
// Subscribe Courses Database
57+
58+
// Subscribe Courses Database
59+
//this.getCourses();
5960
this.subscribe('all-courses', () => {
6061
this.courses = courses.find().fetch();
6162
this.pagination.totalItems = this.courses.length;
6263
this.refreshCourses();
6364
}, true);
6465
}
65-
66+
6667
// Refresh Courses List
6768
refreshCourses() {
6869
let start = (this.pagination.currentPage - 1) * this.pagination.itemsPerPage;
6970
let end = start + this.pagination.itemsPerPage;
7071
this.pagedCourses = this.courses.slice(start, end);
7172
}
72-
73+
7374
// Display the infomation of current state of pagination
7475
getCurrentInfo() {
7576
// This is the number of the first item on the current page
@@ -87,33 +88,34 @@ export class SearchView extends MeteorComponent {
8788

8889
return start.toString() + "-" + end.toString() + " of " + this.pagination.totalItems.toString();
8990
}
90-
91+
9192
// Go to next page function
9293
nextPage() {
93-
94+
9495
// Get the current page
9596
let currentPage = this.pagination.currentPage;
96-
97+
9798
// Get the last possible page
9899
let lastPage = Math.ceil(this.pagination.totalItems / this.pagination.itemsPerPage);
99-
100+
100101
// Check if the current page is the last page
101102
if (currentPage !== lastPage) {
102103
this.pagination.currentPage ++;
103104
this.refreshCourses();
104105
}
105106
}
106-
107+
107108
// Go to previous page function
108109
prevPage() {
109-
110+
110111
// Get the current page
111112
let currentPage = this.pagination.currentPage;
112-
113+
113114
// Check if the current page is the first page
114115
if (currentPage !== 1) {
115116
this.pagination.currentPage --;
116117
this.refreshCourses();
117118
}
118119
}
119120
}
121+

collections/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ The following document describes the MongoDB Schema used by the TuxLab app:
6060
course_number: "15-131",
6161
course_name: "Great Practical Ideas for Computer Scientists",
6262
instructor_name: "Tom Cortina",
63-
hidden: true, // Course is invisible to students. Default is true.
64-
disabled: false, // Enrollment in course is still open. Default is true.
6563
course_description: {
6664
content: "This is the course description.",
6765
syllabus: "This is the course syllabus"

server/imports/lab/methods.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
1-
import { Meteor } from 'meteor/meteor';
2-
import { Mongo } from 'meteor/mongo';
3-
import { check } from 'meteor/check';
4-
51
declare var Collections : any;
6-
72
Meteor.methods({
83
'prepareLab': function(courseId : String,labId : Number){
94
console.log("here");
105
// var course = Collections.courses.findOne({_id: courseId}).fetch();
116
//var t = require('../api/labExec.js');
127
// return course.labs.find((l) => { return l._id == labId; });
13-
},
14-
'search_courses': function(text : String){
15-
var courses = Collections.courses;
16-
17-
var search_pattern = new RegExp(text,"i");
18-
19-
var number_search = {"course_number" : search_pattern};
20-
var alternate_number_search = {$where: "this.course_number.replace(/[ .-]/g,'') == '"+text+"'"};
21-
var name_results = {"course_name" : search_pattern};
22-
23-
var results = courses.find({$and : [{"visible" : true}, {$or : [number_search, alternate_number_search, name_results]}}).limit(15);
24-
25-
return results;
26-
}
8+
}
279
});
2810

0 commit comments

Comments
 (0)