Permalink
Browse files

Style changes, fixed btn-group layout of suggestions

  • Loading branch information...
1 parent f32b943 commit d10a85d692d85827d26eed4cdc8bcac6f8c22996 @sangeeth96 sangeeth96 committed Dec 26, 2016
Showing with 30 additions and 20 deletions.
  1. +5 −4 css/style.css
  2. +1 −2 index.html
  3. +23 −13 js/autocomplete_course.js
  4. +1 −1 js/colorChange.js
View
@@ -339,6 +339,7 @@ footer a:hover {
.tt-course-code {
display: block;
text-align: center;
+ font-size: 0.9em;
}
@@ -386,12 +387,12 @@ input {
color: black !important;
}
-#insertSlotBtn {
- margin: 1em;
+#insertSlotBtn .btn {
+ white-space: normal;
}
-#insertSlotBtn .btn {
- white-space: normal!important;
+#insertSlotBtn:empty {
+ margin-bottom: 0;
}
#inputCourseCode,
View
@@ -350,8 +350,7 @@
</div>
</div>
<!-- inserted slot buttons here -->
- <div id="insertSlotBtn" class="row">
- </div>
+ <div id="insertSlotBtn" class="form-group col-xs-12"></div>
<div class="form-group col-xs-12 col-md-6">
<label for="inputSlotString" class="control-label">Slot:</label>
<div>
@@ -10,9 +10,7 @@ function addSlotSelectionButtons(type, slot, faculty, credits, venue) {
btnValue = slot + '|' + faculty + '|' + type + '|' + venue + '|' + credits;
var insert =
- '<div class="col-xs-12 col-sm-6 col-md-4">' +
- '<button class="btn btn-default btn-block" type="button" value="' + btnValue + '" onclick="slotSelectionBtnClicked(this.value)">' + btnText + '</button>' +
- '</div>';
+ '<a class="btn btn-default" href="#" data-value="' + btnValue + '" onclick="event.preventDefault();slotSelectionBtnClicked(this.getAttribute(\'data-value\'));">' + btnText + '</a>';
return insert;
}
@@ -28,15 +26,30 @@ function slotSelectionBtnClicked(value) {
}
function getSlots(searchCode) {
+ var BUTTONS_PER_ROW = 3;
+ var total = 0;
+ var btnGrpHtml = '';
+ var insert = '';
+
$('#insertSlotBtn').html('');
- var insert = '<div class="btn-group" role="group">';
$.each(all_data, function (key, value) {
if (value.CODE == searchCode) {
// append slots to add course panel
- insert = insert + addSlotSelectionButtons(value.TYPE, value.SLOT, value.FACULTY, value.CREDITS.toString(), value.VENUE);
+ if(total % BUTTONS_PER_ROW === 0) {
+ btnGrpHtml += btnGrpHtml ? '</div>' : '';
+ insert += btnGrpHtml;
+ btnGrpHtml = '';
+ btnGrpHtml += '<div class="btn-group btn-group-justified" role="group">';
+ }
+
+ btnGrpHtml += addSlotSelectionButtons(value.TYPE, value.SLOT, value.FACULTY, value.CREDITS.toString(), value.VENUE);
+ ++total;
}
});
- insert = insert + '</div>'
+
+ btnGrpHtml += '</div>';
+ insert += btnGrpHtml;
+
$('#insertSlotBtn').append(insert);
}
@@ -69,9 +82,7 @@ var courseCodeOption = {
}
},
- placeholder: "eg: ITE1008",
-
- theme: "round"
+ placeholder: "eg: ITE1008"
};
var courseTitleOption = {
@@ -98,10 +109,9 @@ var courseTitleOption = {
}
},
- placeholder: "eg: Open Source programming",
-
- theme: "round"
+ placeholder: "eg: Open Source programming"
};
$("#inputCourseTitle").easyAutocomplete(courseTitleOption);
-$("#inputCourseCode").easyAutocomplete(courseCodeOption);
+$("#inputCourseCode").easyAutocomplete(courseCodeOption);
+$("div.easy-autocomplete").attr("style", "");
View
@@ -123,7 +123,7 @@ var CRM = (function () {
var $slot = $("." + slot);
if (!~$slot.text().indexOf(code)) {
- $slot.append('<span class="tt-course-code">' + code + '<br>' + venue + '</span>');
+ $slot.append('<span class="tt-course-code">' + code + ' - ' + venue + '</span>');
}
},

0 comments on commit d10a85d

Please sign in to comment.