Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@
## 2024-07-13 - 일괄 μ—…λ‘œλ“œ 폼에 프리셋 λ²„νŠΌ 및 파일 크기 미리보기 μΆ”κ°€
**Learning:** 일괄 파일 μ—…λ‘œλ“œ νΌμ—μ„œ λŒ€μƒ λ°”μ΄νŠΈ(target_bytes) μž…λ ₯ ν•„λ“œλ§Œ μ œκ³΅ν•˜λ©΄ μ‚¬μš©μžκ°€ μ›ν•˜λŠ” μš©λŸ‰μ„ λ°”μ΄νŠΈ λ‹¨μœ„λ‘œ μ •ν™•νžˆ κ³„μ‚°ν•˜κΈ° μ–΄λ €μ›Œ μ‚¬μš©μ„±μ΄ λ–¨μ–΄μ§‘λ‹ˆλ‹€. μ‚¬μš©μžκ°€ μ—¬λŸ¬ νŒŒμΌμ„ μ—…λ‘œλ“œν•  λ•Œ 총 파일 크기λ₯Ό νŒŒμ•…ν•˜μ§€ λͺ»ν•΄ μ—…λ‘œλ“œ μ œν•œμ„ μ΄ˆκ³Όν•˜κ±°λ‚˜ 잘λͺ»λœ λŒ€μƒ λ°”μ΄νŠΈλ₯Ό μ„€μ •ν•  μœ„ν—˜μ΄ ν½λ‹ˆλ‹€.
**Action:** 일괄 파일 μ—…λ‘œλ“œ 폼에도 단일 파일 μ—…λ‘œλ“œ 폼과 λ™μΌν•˜κ²Œ λŒ€μƒ λ°”μ΄νŠΈλ₯Ό μ‰½κ²Œ 선택할 수 μžˆλŠ” λΉ λ₯Έ 프리셋 λ²„νŠΌμ„ μΆ”κ°€ν•˜κ³ , `onchange` 이벀트 λ°œμƒ μ‹œ μ„ νƒλœ λͺ¨λ“  파일의 크기λ₯Ό ν•©μ‚°ν•˜μ—¬ μ‚¬λžŒμ΄ 읽기 μ‰¬μš΄ λ‹¨μœ„(MiB, GiB λ“±)둜 미리보기λ₯Ό μ œκ³΅ν•˜λ„λ‘ JavaScript λ‘œμ§μ„ κ°œμ„ ν–ˆμŠ΅λ‹ˆλ‹€.
## 2024-07-16 - 빈 숫자 μž…λ ₯ μ‹œ μœ νš¨μ„± 검사 μ—λŸ¬ λ…ΈμΆœ λ°©μ§€
**Learning:** 숫자 μž…λ ₯ ν•„λ“œμ—μ„œ μ‚¬μš©μžκ°€ 값을 μ§€μ›Œ 빈칸(`''`)이 λ˜μ—ˆμ„ λ•Œ, `parseInt(this.value, 10)`λŠ” `NaN`을 λ°˜ν™˜ν•©λ‹ˆλ‹€. 이 λ•Œ μ»€μŠ€ν…€ μœ νš¨μ„± 검사(`setCustomValidity`)둜 μ—λŸ¬λ₯Ό μ„€μ •ν•˜λ©΄, μ‚¬μš©μžκ°€ μƒˆλ‘œμš΄ 값을 μž…λ ₯ν•˜κΈ° μ „μ΄λ‚˜ HTML5의 κΈ°λ³Έ `required` 속성이 μž‘λ™ν•˜κΈ°λ„ 전에 μ¦‰μ‹œ λΆˆν•„μš”ν•œ μ—λŸ¬ λ©”μ‹œμ§€("Must be greater than 0")κ°€ 화면에 λ…ΈμΆœλ˜κ³  `aria-invalid`κ°€ μ„€μ •λ˜μ–΄ μ‹œκ°μ , μ ‘κ·Όμ„± μΈ‘λ©΄μ—μ„œ μ‚¬μš©μž κ²½ν—˜(UX)을 크게 μ €ν•˜μ‹œν‚΅λ‹ˆλ‹€.
**Action:** 숫자 μž…λ ₯을 인라인으둜 검증할 λ•Œ 빈 λ¬Έμžμ—΄ μƒνƒœ(`this.value === ''`)λ₯Ό λ¨Όμ € ν™•μΈν•˜κ³ , 빈칸인 경우 `setCustomValidity('')` 및 `removeAttribute('aria-invalid')`λ₯Ό ν˜ΈμΆœν•˜μ—¬ μ»€μŠ€ν…€ μ—λŸ¬ μƒνƒœλ₯Ό λͺ…μ‹œμ μœΌλ‘œ ν•΄μ œν•˜λ„λ‘ κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€. μ΄λ ‡κ²Œ ν•˜λ©΄ μ‚¬μš©μžκ°€ 값을 μ§€μšΈ λ•Œ κ±°μŠ¬λ¦¬λŠ” 였λ₯˜κ°€ λ°œμƒν•˜μ§€ μ•ŠμœΌλ©°, ν•„μˆ˜ μž…λ ₯ 검증은 λΈŒλΌμš°μ €μ˜ κΈ°λ³Έ HTML λ™μž‘μ— μœ„μž„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
14 changes: 14 additions & 0 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ async def add_security_headers(request: Request, call_next):
);
});

if (this.value === '') {
preview.innerText = '';
this.setCustomValidity('');
this.removeAttribute('aria-invalid');
return;
}

if (isNaN(val) || val <= 0) {
preview.innerText = 'Must be greater than 0.';
preview.style.color = '#dc3545';
Expand Down Expand Up @@ -282,6 +289,13 @@ async def add_security_headers(request: Request, call_next):
);
});

if (this.value === '') {
preview.innerText = '';
this.setCustomValidity('');
this.removeAttribute('aria-invalid');
return;
}

if (isNaN(val) || val <= 0) {
preview.innerText = 'Must be greater than 0.';
preview.style.color = '#dc3545';
Expand Down
Loading