feat(cafe24): 편집기에서 상품명 수정

제목 옆 연필 버튼 → 입력칸 → 저장. 이름만 바꾸려고 카페24 관리자에 들어갈
필요가 없어진다.

- POST /cafe24/products/{no}/name (JSON) 추가. 쓰기 전에 카페24 현재값을 읽어
  이전 이름을 감사로그(rename_product)에 남긴다 - 되돌릴 revision 이 없으므로
  로그가 유일한 복구 단서다. 값이 같으면 호출하지 않는다.
- build_update_payload/update_product 에 product_name 추가(부분 수정이라
  상세설명·진열·판매는 그대로).
- 빈 값과 250자 초과는 서버에서 400. 화면도 maxlength 로 막는다.
- 평소에는 읽기 전용 제목이고 연필을 눌러야 입력칸이 된다 - 클릭 한 번으로
  실수로 고쳐지지 않게. Enter 저장, Esc 취소.
- 화면은 요청값이 아니라 카페24가 확인해 준 이름으로 다시 그리고, 왼쪽 목록의
  이름·정렬키(data-name)도 함께 갱신한다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-19 18:35:37 +09:00
parent 5127600a3d
commit 3537e058b0
6 changed files with 219 additions and 4 deletions
@@ -12,8 +12,25 @@
{% endif %}
<div class="cf24-editor-head">
<div>
<h3 class="cf24-editor-title">{{ info.product_name or '상품' }}</h3>
{# 제목 = 상품명. 연필 버튼을 누르면 입력칸으로 바뀐다(평소에는 읽기 전용 —
클릭만으로 실수로 고쳐지지 않게). 저장은 JS 가 POST /products/{no}/name.
카페24 조회에 실패했을 때(desc 없음)는 현재 이름을 믿을 수 없어 버튼을 뺀다. #}
<div class="cf24-name-box" id="cf24-name" data-product-no="{{ product_no }}">
<h3 class="cf24-editor-title" id="cf24-name-view">
<span id="cf24-name-text">{{ info.product_name or '상품' }}</span>
{% if desc %}
<button type="button" class="cf24-name-edit" id="cf24-name-edit"
title="상품명 수정 (카페24에 즉시 반영)" aria-label="상품명 수정">✎</button>
{% endif %}
</h3>
{% if desc %}
<div class="cf24-name-form is-hidden" id="cf24-name-form">
<input class="cf24-name-input" id="cf24-name-input" type="text" maxlength="250"
value="{{ info.product_name }}" aria-label="상품명" />
<button class="erp-btn erp-btn-primary" type="button" id="cf24-name-save">저장</button>
<button class="erp-btn erp-btn-outline" type="button" id="cf24-name-cancel">취소</button>
</div>
{% endif %}
<p class="cf24-editor-sub">
상품번호 {{ product_no }}
{% if info.product_code %}· <code>{{ info.product_code }}</code>{% endif %}