Skip to content

Commit 08e7b86

Browse files
committedAug 29, 2018
Remove Unwanted Code
1 parent 33fc3e3 commit 08e7b86

File tree

3 files changed

+27
-49
lines changed

3 files changed

+27
-49
lines changed
 

Diff for: ‎public_html/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</div>
3737

3838
<div class="row no-gutters">
39-
<div id="side-menu" class="col-sm-2" style="padding: 0; overflow-y: scroll;overflow-x: hidden">
39+
<div id="side-menu" class="col-sm-2">
4040
<hr style="margin: 0; border-top: solid 1px #999">
4141
<div style="padding: 15px; color: #eee; font-size: 16px;" id="sidebar">
4242
<div id="filters" style="color: white; display: none"></div>

Diff for: ‎public_html/index.js

+23-47
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ $(document).ready(function () {
3131
var api = '/api/v1';
3232
var eventsData;
3333

34-
getCentres();
3534

3635
$('#filters').show();
3736

@@ -81,6 +80,8 @@ $(document).ready(function () {
8180

8281
}
8382

83+
getCentres();
84+
8485
function getCentre(centreId) {
8586
$.get(`${api}/centres/${centreId}`).done((centreData) => {
8687
if (centreData.success) {
@@ -236,7 +237,6 @@ $(document).ready(function () {
236237
const events = [];
237238
const resources = [];
238239
const colors = ['#EB5667', '#1E88E5', '#B96BC6', '#28B294', '#FF8F00', '#31C6C7'];
239-
let batchColors = {};
240240
let colorCounter = 0;
241241

242242
$('#calendar').remove();
@@ -263,6 +263,7 @@ $(document).ready(function () {
263263
id: room.id,
264264
title: room.name,
265265
eventColor: currentColor,
266+
capacity: room.capacity,
266267
centreId: room.centreId
267268
});
268269
$colors.append(`
@@ -274,63 +275,39 @@ $(document).ready(function () {
274275
});
275276

276277
$colors.append(`
277-
<div class="col">
278-
</div>
279-
<div class="col">
280-
</div>
281-
`);
278+
<div class="col">
279+
</div>
280+
<div class="col">
281+
</div>
282+
`);
282283

283284
$.get(`${api}/centres/${centre.id}/batches/?batch=${getBatch}`).done((data) => {
284285
if (data.success) {
285286
let batches = data.data;
286287

287288
batches.forEach(function (batch) {
288-
289-
const $lectures = $(`#batch-${batch.id}`);
290-
let lectures = batch.lectures.sort(function (batch1, batch2) {
291-
return batch1.id - batch2.id;
292-
});
289+
let lectures = batch.lectures;
293290
lectures.forEach((lecture) => {
294-
let eventObject = {
295-
lectureId: lecture.id,
296-
title: lecture.name,
297-
batchCapacity: batch.size,
298-
batchName: batch.name,
299-
batchId: batch.id,
300-
teacherId: batch.teacher.id,
301-
teacherName: batch.teacher.name,
302-
courseName: batch.course.name,
303-
stick: true
304-
};
305-
306291
if (lecture.startTime && lecture.endTime) {
307-
308-
events.push(Object.assign({}, eventObject, {
292+
events.push({
293+
lectureId: lecture.id,
294+
title: lecture.name,
309295
start: moment.utc(lecture.startTime),
310296
end: moment.utc(lecture.endTime),
297+
stick: true,
311298
resourceId: lecture.roomId,
312-
}));
313-
314-
} else {
315-
$lectures.append(`
316-
<a id="lecture-${lecture.id}" class="list-group-item" data-parent="#batch-${batch.id}">
317-
${lecture.name}
318-
</a>
319-
`);
320-
321-
const $lecture = $(`#lecture-${lecture.id}`);
322-
323-
$lecture.data('event', Object.assign({}, eventObject, {
324-
hours: batch.hoursPerLecture !== null ? batch.hoursPerLecture : batch.course.hours,
325-
start: moment().startOf('day'),
326-
defaultRoom: batch.roomId,
327-
defaultTime: batch.defaultTime,
328-
}));
299+
batchCapacity: batch.size,
300+
batchId: batch.id,
301+
batchName: batch.name,
302+
teacherId: batch.teacher.id,
303+
teacherName: batch.teacher.name,
304+
courseName: batch.course.name
305+
});
329306
}
330307
});
331308

332309
});
333-
$('#calendar').css('overflow-y', 'scroll');
310+
334311
eventsData = events.slice();
335312
$('#calendar').fullCalendar({
336313
// put your options and callbacks here
@@ -377,6 +354,7 @@ $(document).ready(function () {
377354
groupByDateAndResource: true,
378355
dateIncrement: {days: 1}
379356
}
357+
380358
},
381359
eventMouseover: function (event, jsEvent, view) {
382360
var index = -1;
@@ -399,9 +377,7 @@ $(document).ready(function () {
399377
`
400378
}).tooltip('show');
401379
}
402-
403380
});
404-
405381
} else {
406382
$.toast({
407383
heading: 'Warning',
@@ -454,4 +430,4 @@ $(document).ready(function () {
454430
console.log(err)
455431
});
456432
}
457-
})
433+
});

Diff for: ‎public_html/style.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ body {
1414
height: 100vh;
1515
/*position: fixed;*/
1616
background-color: #343a40;
17+
padding: 0;
18+
overflow-x: hidden;
1719
}
1820

1921
.header-bar {
@@ -234,4 +236,4 @@ a {
234236

235237
.fc-content {
236238
color: white;
237-
}
239+
}

0 commit comments

Comments
 (0)
Please sign in to comment.