Skip to content

Commit

Permalink
Merge pull request #168 from GBGreenBravo/main
Browse files Browse the repository at this point in the history
[feat] 독후감 작성 & 마이페이지 기능 고도화
  • Loading branch information
GBGreenBravo authored Nov 23, 2023
2 parents 3104986 + 0fb1bfe commit cbb0029
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public List<BookReportEntity> getPublicBookReportsByBookId(Long bookId) {
public void updateBookReport(BookReportDTO bookReport, MemberDTO memberDTO) {
bookReport.getBookReportEntity().setLastModifiedBy(memberDTO.getEmail());
bookReport.getBookReportEntity().setMemberEntity(memberDTO.getMemberEntity());
System.out.println("bookReport = " + bookReport);
bookReportRepository.save(bookReport.getBookReportEntity());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@
var listItem = $('<li class="list-group-item">')
.text(book.title)
.data('book-id', book.id)
.data('book-title', book.title)
.click(function () {
selectedBookId = $(this).data('book-id');
$('.list-group-item').removeClass('selected-book');
$(this).addClass('selected-book');
$('#bookId').val($(this).data('book-id'));
$('#bookTitle').val($(this).data('book-title'));
})
.appendTo(bookSearchResults);
});
Expand Down Expand Up @@ -118,9 +119,10 @@
</div>
<!-- Book ID input with "Find Book" button -->
<div class="mb-3">
<label for="bookId" class="form-label">도서 ID</label>
<label for="bookId" class="form-label">도서</label>
<div class="input-group">
<input type="text" class="form-control" id="bookId" placeholder="도서 ID를 입력하세요">
<input type="text" class="form-control" id="bookTitle" placeholder="'도서 찾기'를 통해 도서를 입력해 주세요">
<input type="hidden" class="form-control" id="bookId">
<button type="button" class="btn btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#bookSearchModal">도서 찾기</button>
</div>
</div>
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/templates/mypage/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,16 @@
}

.scrollable-table {
height: 300px; /* Adjust as needed */
height: 350px; /* Adjust as needed */
overflow-y: auto;
}
</style>
</head>
<script>
function navigateToBookReport(bookReportId) {
window.location.href = '/book-report?id=' + bookReportId;
}
</script>
<body style="position: relative; min-height: 100vh;">
<nav th:replace="~{fragments/navbar :: navbarFragment}"></nav>
<div class="heading">Welcome to Mypage!</div>
Expand Down Expand Up @@ -153,7 +158,7 @@
</tr>
</thead>
<tbody>
<tr th:each="reply : ${replies}">
<tr th:each="reply : ${replies}" th:onclick="|navigateToBookReport(${reply.bookReportEntity.id})|">
<td th:text="${reply.bookReportEntity.title}">책 제목</td>
<td th:text="${reply.content}">내용</td>
<td th:text="${#temporals.format(reply.createdAt, 'yyyy-MM-dd')}">작성일</td>
Expand Down Expand Up @@ -181,7 +186,7 @@
<p>작성된 독후감이 없습니다.</p>
</div>
<tbody>
<tr th:each="bookReport : ${bookReports}">
<tr th:each="bookReport : ${bookReports}" th:onclick="|navigateToBookReport(${bookReport.id})|">
<td th:text="${bookReport.bookEntity.title}">책 제목</td>
<td th:text="${bookReport.title}">독후감 제목</td>
<td th:text="${bookReport.content}">독후감 내용</td>
Expand Down

0 comments on commit cbb0029

Please sign in to comment.