Skip to content

Commit

Permalink
version-2.1.4 fix bug and style (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz403 authored May 2, 2024
1 parent 1b84a20 commit b2ebeb4
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.uoftbox</groupId>
<artifactId>uofttimetablebuilder</artifactId>
<version>2.1.3-RELEASE</version>
<version>2.1.4-RELEASE</version>
<name>uofttimetablebuilder</name>
<description>UofT Timetable Builder</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ public Map<String, Map<String, Map<String, List<CourseInfo>>>> fetchSpecialSecti
Map<String, Set<String>> courseSections = getLockedCourseSections(lockedCourses);

for (String courseCode : courseCodeList) {
sectionCode = courseCode.substring(courseCode.length() - 1);
String courseId = coursesRepository.findMatchCourseId(courseCode, sectionCode);

// 如果courseId为空,则返回404报错
if (courseCode == null) throw new ResponseStatusException(HttpStatus.NOT_FOUND, "COURSE NOT FOUND");
if (courseId == null) throw new ResponseStatusException(HttpStatus.NOT_FOUND, "COURSE NOT FOUND");
ArrayList<Integer> time_list = new ArrayList<>();
fetchSpecialSectionsHelper(courseCode, courseId, time_list, originalCourseSchedule, courseSections);
}
Expand Down
58 changes: 50 additions & 8 deletions src/main/resources/static/css/timetablebuilder.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}

body {
display: grid;
grid-template-rows: auto 1fr;
height: 100vh;
margin: 0;
}

.containerr {
display: flex;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.course-choose-list {
overflow: auto;
Expand All @@ -10,7 +27,7 @@
overflow: auto;
flex: 2;
width: auto;
height: 670px;
height: 100%;
}
.sidebar {
width: 33%;
Expand Down Expand Up @@ -46,7 +63,7 @@
}

#save-btn {
width:20px;
width: 20px;
margin-left: 20px;
left: 310px;
}
Expand All @@ -59,20 +76,28 @@

#share-btn:hover,
#folder-btn:hover,
#github-btn:hover,
#save-btn:hover {
transform: scale(1.2);
}

#folder-btn {
width:30px;
width: 30px;
margin-left: 20px;
cursor: pointer;
left: 240px;
}

#share-btn {
width:30px;
margin-left:auto;
width: 30px;
margin-left: auto;
margin-right: 20px;
cursor: pointer;
}

#github-btn {
width: 30px;
margin-left: auto;
margin-right: 20px;
cursor: pointer;
}
Expand Down Expand Up @@ -255,6 +280,7 @@
align-items: center;
padding: 0.5em 1em;
border-radius: 0 0 10px 10px;
height: 55px;
}

.timetable-header h1 {
Expand All @@ -274,6 +300,21 @@
background-color: #e8e8e8;
}

#large-view {
width: 100%; /* 占满容器宽度 */
height: 100%; /* 占满容器高度 */
}

#large-view table {
flex: 1; /* 每个表格均等占用可用空间 */
width: 100%; /* 表格宽度占满容器宽度 */
height: 100%; /* 表格高度占满分配给它的空间 */
}

#large-view th, #large-view td {
text-align: center;
}

.title {
font-family: "Arial", sans-serif;
color: #055eb6;
Expand Down Expand Up @@ -382,21 +423,22 @@
.timetable {
width: 100%;
order: 2;
height: 100%;
}

.timetable-header {
zoom: 80%;
}

#folder-btn{
#folder-btn {
left: 215px;
}

#save-btn{
#save-btn {
left: 255px;
}

#share-btn{
#share-btn {
margin-right: 5px;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ <h5 class="modal-title" id="detaillInfoLabel">Detailed Information</h5>
<img id="share-btn" src="./lib/share.svg" title="download timetable">
<nav class="timetable-header-nav">
</nav>
<a href="https://github.com/UofT-Box/UofT-Timetable-Builder" target="_blank">
<img id="github-btn" src="./lib/github.svg" title="github">
</a>
<a href="https://forms.gle/cVXp4STrensowoPw9" target="_blank"><button class="report-issue-btn">Report
Issue</button></a>
</div>
Expand All @@ -76,7 +79,7 @@ <h5 class="modal-title" id="detaillInfoLabel">Detailed Information</h5>
<div id="large-view" class="timetable-view">
<!-- 大视图的课程表内容 -->
<br>
<div style="width: 100%;">
<div style="width: 100%; height: 100%;">
<table class="table table-bordered" id="table-body" style="text-align: center;">
<thead id="timetable-head">
<tr>
Expand Down
19 changes: 19 additions & 0 deletions src/main/resources/static/lib/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/main/resources/static/scr/timetablebuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var all_saved_timetables = {};

var blank_timetable = {};

var fallTimetableInfo = {};
var winterTimetableInfo = {};

//************ UI Element Initialization ****************//
var $select = $(".relevantCourses").selectize(); // 输入-下滑选择框生成
var selectControl = $select[0].selectize;
Expand Down Expand Up @@ -399,6 +402,10 @@ function saveTimetable(data = null) {
timetableFall[tempTime][day] = info;
}
}
if (!(courseInfo.course in fallCourseChoose)) {
fallCourseChoose[courseInfo.course] = [];
}
fallCourseChoose[courseInfo.course].push(info);
}
}
// 将winter课程元素加入至winter timetable模板
Expand All @@ -419,6 +426,11 @@ function saveTimetable(data = null) {
timetableWinter[tempTime][day] = info;
}
}
if (!(courseInfo.course in winterCourseChoose)) {
winterTimetableInfo[courseInfo.course] = [];
}
console.log(courseInfo.course)
winterTimetableInfo[courseInfo.course].push(info);
}
}
received_timetables[index] = {
Expand Down Expand Up @@ -534,6 +546,7 @@ function displayTimetable(term, index) {
if (timetable[time][j] !== "") {
let info = timetable[time][j];
var courseSectionKey = info["course"] + "<br>" + info["section"];

var isLockedFall = lockedCoursesFall.includes(courseSectionKey);
var isLockedWinter = lockedCoursesWinter.includes(courseSectionKey);
var lockIconClass =
Expand Down Expand Up @@ -1156,6 +1169,13 @@ function getTimeInfo(courseCode, sectionCode) {
return info;
}

function getchangeCourseTimeInfo(courseCode, sectionCode) {
if (sectionCode === "F") {
return fallTimetableInfo[courseCode];
}
return winterTimetableInfo[courseCode];
}

function deleteCourse(deleteBtn) {
let deleteId = deleteBtn.id;

Expand Down Expand Up @@ -1483,3 +1503,19 @@ function downloadPDF() {
document.body.removeChild(link);
});
}
function adjustTableSize() {
var container = document.querySelector('.large-view');
var table = container.querySelector('table');
var availableHeight = container.clientHeight;
var availableWidth = container.clientWidth;

// 调整表格的高度以适应容器
table.style.height = `${availableHeight}px`;
table.style.width = `${availableWidth}px`;
}

// 在窗口大小改变时重新调整
window.addEventListener('resize', adjustTableSize);

// 初始调整
adjustTableSize();

0 comments on commit b2ebeb4

Please sign in to comment.