Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
venue to timetable added
fixed #17
  • Loading branch information
vatz88 committed Dec 26, 2016
1 parent 4b710c0 commit 3be8e78
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion appcache.manifest
@@ -1,5 +1,5 @@
CACHE MANIFEST
# 2016-12-25
# 2016-12-26

css/style.css
js/script.js
Expand Down
1 change: 1 addition & 0 deletions css/style.css
Expand Up @@ -381,6 +381,7 @@ input {
#inputCourseTitle,
#inputSlotString,
#inputFaculty,
#inputVenue,
.list-group-item {
text-transform: uppercase;
}
Expand Down
14 changes: 10 additions & 4 deletions index.html
Expand Up @@ -353,19 +353,25 @@ <h4>Add Courses To Timetable</h4>
<div id="insertSlotBtn" class="row">
</div>
</div>
<div class="form-group col-xs-12">
<div class="form-group col-xs-12 col-md-6">
<label for="inputSlotString" class="control-label">Slot:</label>
<div>
<input type="text" class="form-control" id="inputSlotString" placeholder="eg: L1+L2+L3">
</div>
</div>
<div class="form-group col-xs-12">
<div class="form-group col-xs-12 col-md-6">
<label for="inputFaculty" class="control-label">Faculty:</label>
<div>
<input type="text" placeholder="eg: John Doe" class="form-control" id="inputFaculty">
</div>
</div>
<div class="form-group col-xs-12">
<div class="form-group col-xs-12 col-md-6">
<label for="inputVenue" class="control-label">Venue:</label>
<div>
<input type="text" placeholder="eg: SJTG01" class="form-control" id="inputVenue">
</div>
</div>
<div class="form-group col-xs-12 col-md-6">
<label for="inputCourseCredits" class="control-label">Credits:</label>
<div>
<input type="number" class="form-control" placeholder="eg: 4" id="inputCourseCredits">
Expand Down Expand Up @@ -457,4 +463,4 @@ <h4>Add Courses To Timetable</h4>
<script src="js/enjoyhintsetup.js"></script>
</body>

</html>
</html>
1 change: 1 addition & 0 deletions js/autocomplete_course.js
Expand Up @@ -24,6 +24,7 @@ function slotSelectionBtnClicked(value) {
value = value.split('|');
$('#inputSlotString').val(value[0]);
$('#inputFaculty').val(value[1]);
$('#inputVenue').val(value[3]);
$('#inputCourseCredits').val(value[4]);
}

Expand Down
36 changes: 20 additions & 16 deletions js/colorChange.js
Expand Up @@ -6,10 +6,11 @@
var totalCredits = 0;

var CRM = (function () {
function CourseRecord(slots, title, code, fac, credits, $li) {
function CourseRecord(slots, title, code, venue, fac, credits, $li) {
this.slots = slots;
this.title = title;
this.code = code;
this.venue = venue;
this.fac = fac;
this.credits = credits;
this.$li = $li;
Expand All @@ -29,9 +30,9 @@ var CRM = (function () {

var CRM = {
courses: [],
add: function (slots, title, code, fac, credits, $li) {
add: function (slots, title, code, venue, fac, credits, $li) {
slots = this.expandSlots(slots);
var record = new CourseRecord(slots, title, code, fac, credits, $li);
var record = new CourseRecord(slots, title, code, venue, fac, credits, $li);
var clashes = this.getClashingSlots(record);
if (clashes.length()) {
record.isClashing = true;
Expand Down Expand Up @@ -99,7 +100,7 @@ var CRM = (function () {

record.slots.forEach(function (slot) {
this.highlight(slot);
this.appendCourseCode(slot, record.code);
this.appendCourseCode(slot, record.code, record.venue);
}, this);

if (record.isClashing) {
Expand All @@ -118,11 +119,11 @@ var CRM = (function () {
$("." + slot).addClass("highlight");
},

appendCourseCode: function (slot, code) {
appendCourseCode: function (slot, code, venue) {
var $slot = $("." + slot);

if (!~$slot.text().indexOf(code)) {
$slot.append('<span class="tt-course-code">' + code + '</span>');
$slot.append('<span class="tt-course-code">' + code + '<br>' + venue + '</span>');
}
},

Expand Down Expand Up @@ -201,6 +202,7 @@ var CRM = (function () {
var courseInput = $("#inputCourseTitle");
var creditsInput = $("#inputCourseCredits");
var courseCodeInput = $("#inputCourseCode");
var venueInput = $("#inputVenue");
var slotInput = $("#inputSlotString");
var totalContainer = $("#slot-sel-area .list-group li.total");
var totalSpan = totalContainer.find(".badge");
Expand All @@ -216,25 +218,26 @@ var CRM = (function () {
faculty = facultyInput.val().trim();
course = courseInput.val().trim();
courseCode = courseCodeInput.val().trim();
venue = venueInput.val().trim();
credits = Number(creditsInput.val());

slotArray = slot.split(/\s*\+\s*/);


normSlotString = slotArray.join(" + ");
li = $('<li class="list-group-item">' +

li = $('<li class="list-group-item text-center">' +
'<div class="row">' +
'<div class="slots col-xs-2">' + normSlotString + '</div>' +
'<div class="course col-xs-4">' + course + '</div>' +
'<div class="faculty col-xs-4">' + faculty + '</div>' +
'<div class="col-xs-2"><div class="row">' +
'<div class="col-xs-12 col-sm-6 text-right">' +
'<div class="col-xs-4 col-sm-2">' + normSlotString + '</div>' +
'<div class="col-xs-2 col-sm-1">' + courseCode + '</div>' +
'<div class="hidden-xs col-sm-3">' + course + '</div>' +
'<div class="col-xs-5 col-sm-3">' + faculty + '</div>' +
'<div class="hidden-xs col-sm-1">' + venue + '</div>' +
'<div class="hidden-xs col-sm-1">' +
'<span class="badge">' + (credits ? credits : 0) + '</span>' +
'</div>' +
'<div class="col-xs-12 col-sm-6 text-right">' +
'<div class="col-xs-1 col-sm-1 text-right">' +
'<span class="close">&times;</span>' +
'</div>' +
'</div></div>' +
'</div>' +
'</li>');

Expand All @@ -252,13 +255,14 @@ var CRM = (function () {
}

courseCodeInput.val("");
venueInput.val("");
facultyInput.val("");
courseInput.val("");
slotInput.val("");
creditsInput.val("");
$('#insertSlotBtn').html('');

CRM.add(slotArray, course, courseCode, faculty, credits, li);
CRM.add(slotArray, course, courseCode, venue, faculty, credits, li);
}

$("#slot-sel-area .panel-body #markBtn").click(submitSlotData);
Expand Down
2 changes: 1 addition & 1 deletion js/enjoyhintsetup.js
Expand Up @@ -7,7 +7,7 @@ var enjoyhint_script_steps = [{
}, {
"next .B1-tile": "<p>Use quick selection to select all at once</p>"
}, {
"next .panel-heading": "<p>Add courses to timetable</p>"
"next .panel-heading": "<p>Search and add courses to timetable</p>"
}, {
"next #takeScreenShot": "<p>Take timetable screenshot to share with friends</p>"
}, {
Expand Down

0 comments on commit 3be8e78

Please sign in to comment.