Skip to content

Commit eeb3d1d

Browse files
authored
Merge pull request #59 from HD152521/feature/admin-intro-section-save-buttons
Add per-section save buttons for intro admin editor
2 parents d8d8b49 + dd86686 commit eeb3d1d

2 files changed

Lines changed: 59 additions & 10 deletions

File tree

src/main/resources/templates/adminpage/user/school/manageSchool.html

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@
652652
const schoolPicUrlInput = document.getElementById("schoolPicUrl");
653653
const title = titleInput ? titleInput.value.trim() : "";
654654
const description = descInput ? descInput.value.trim() : "";
655-
const schoolPicUrl = descInput ? schoolPicUrlInput.value.trim() : "";
655+
const schoolPicUrl = schoolPicUrlInput ? schoolPicUrlInput.value.trim() : "";
656656

657657
const advantageInputs = document.querySelectorAll("#advantages-list input");
658658
const advantages = Array.from(advantageInputs)
@@ -820,7 +820,24 @@
820820
}
821821
}
822822

823-
window.saveIntroBoard = saveIntroBoard;
823+
async function saveIntroSection(sectionKey) {
824+
const saveFn = window.saveIntroBoard;
825+
if (typeof saveFn !== "function") {
826+
alert("저장 함수를 찾을 수 없습니다.");
827+
return;
828+
}
829+
830+
const originalShowBoardList = window.showBoardList;
831+
window.showBoardList = () => {};
832+
try {
833+
await saveFn();
834+
} finally {
835+
window.showBoardList = originalShowBoardList;
836+
}
837+
}
838+
839+
window.saveIntroBoard = saveIntroBoard;
840+
window.saveIntroSection = saveIntroSection;
824841

825842
</script>
826843

@@ -1954,5 +1971,5 @@
19541971
});
19551972
});
19561973
</script>
1957-
</body>
1974+
</body>
19581975
</html>

src/main/resources/templates/fragments/school/admin/intro-editor.html

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ <h2 class="section-title">학교 소개</h2>
6060
소개 페이지 상단에 노출될 제목과 간단한 설명, 학교의 강점을 입력해주세요.
6161
</p>
6262
</div>
63+
<button type="button"
64+
onclick="saveIntroSection('intro')"
65+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-primary text-white text-xs md:text-sm hover:bg-primary/90 transition-colors whitespace-nowrap shadow-md shadow-primary/20">
66+
Save
67+
</button>
6368
</div>
6469

6570
<div class="space-y-4">
@@ -135,6 +140,11 @@ <h2 class="section-title">기본 정보</h2>
135140
학교의 이름, 설립연도, 위치, 간단한 특징을 입력해주세요.
136141
</p>
137142
</div>
143+
<button type="button"
144+
onclick="saveIntroSection('basicInfo')"
145+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-primary text-white text-xs md:text-sm hover:bg-primary/90 transition-colors whitespace-nowrap shadow-md shadow-primary/20">
146+
Save
147+
</button>
138148
</div>
139149

140150
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
@@ -201,6 +211,11 @@ <h2 class="section-title">대학 랭킹</h2>
201211
내부 정렬이나 노출 순서를 위한 숫자입니다. 숫자가 작을수록 상단에 노출됩니다.
202212
</p>
203213
</div>
214+
<button type="button"
215+
onclick="saveIntroSection('collegeRank')"
216+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-primary text-white text-xs md:text-sm hover:bg-primary/90 transition-colors whitespace-nowrap shadow-md shadow-primary/20">
217+
Save
218+
</button>
204219
</div>
205220

206221
<div class="w-full md:w-44">
@@ -227,6 +242,11 @@ <h2 class="section-title">추가 링크 목록</h2>
227242
입학 안내, 장학 제도, 기숙사 안내 등 자주 사용하는 페이지 링크를 등록할 수 있습니다.
228243
</p>
229244
</div>
245+
<button type="button"
246+
onclick="saveIntroSection('urls')"
247+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-primary text-white text-xs md:text-sm hover:bg-primary/90 transition-colors whitespace-nowrap shadow-md shadow-primary/20">
248+
Save
249+
</button>
230250
</div>
231251

232252
<div id="url-list" class="space-y-3"></div>
@@ -248,12 +268,19 @@ <h2 class="section-title">단과대 정보</h2>
248268
여러 단과대를 추가하고, 각 단과대에 포함된 학과들을 입력할 수 있습니다.
249269
</p>
250270
</div>
251-
<button type="button"
252-
onclick="addCollege()"
253-
class="inline-flex items-center px-3 py-1.5 rounded-button bg-gray-800 text-gray-100 text-xs md:text-sm hover:bg-gray-700 border border-gray-700">
254-
<i class="ri-add-line mr-1 text-base"></i>
255-
단과대 추가
256-
</button>
271+
<div class="flex items-center gap-2">
272+
<button type="button"
273+
onclick="saveIntroSection('college')"
274+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-primary text-white text-xs md:text-sm hover:bg-primary/90 transition-colors whitespace-nowrap shadow-md shadow-primary/20">
275+
Save
276+
</button>
277+
<button type="button"
278+
onclick="addCollege()"
279+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-gray-800 text-gray-100 text-xs md:text-sm hover:bg-gray-700 border border-gray-700">
280+
<i class="ri-add-line mr-1 text-base"></i>
281+
단과대 추가
282+
</button>
283+
</div>
257284
</div>
258285

259286
<!-- 단과대 카드들이 여기 들어감 -->
@@ -269,6 +296,11 @@ <h2 class="section-title">홈페이지 URL</h2>
269296
대표 국문/영문 홈페이지 주소를 입력합니다.
270297
</p>
271298
</div>
299+
<button type="button"
300+
onclick="saveIntroSection('homepage')"
301+
class="inline-flex items-center px-3 py-1.5 rounded-button bg-primary text-white text-xs md:text-sm hover:bg-primary/90 transition-colors whitespace-nowrap shadow-md shadow-primary/20">
302+
Save
303+
</button>
272304
</div>
273305

274306
<div class="space-y-4">
@@ -323,4 +355,4 @@ <h2 class="section-title">홈페이지 URL</h2>
323355

324356

325357
</body>
326-
</html>
358+
</html>

0 commit comments

Comments
 (0)