feat(cafe24): 진열/판매 배지 클릭으로 상태 토글
편집기 오른쪽 위 배지를 눌러 진열·판매를 바로 바꾼다. 상태만 바꾸려고
카페24 관리자에 들어갈 필요가 없어진다.
- POST /cafe24/products/{no}/status (JSON) 추가. 상세설명은 건드리지 않아
BACKUP revision 을 만들지 않는다 - 되돌릴 HTML 이 없고 다시 눌러 복구된다.
- 요청값을 낙관적으로 반영하지 않고 쓰기 후 카페24가 돌려준 실제 상태로
화면을 다시 그린다. 실패해도 화면과 카페24가 어긋나지 않는다.
- 왼쪽 목록의 점과 정렬용 data-display/data-selling 도 함께 갱신(목록을
다시 받지 않으므로).
- 카페24 조회 실패 시에는 현재 상태를 믿을 수 없어 배지를 버튼으로 만들지
않는다.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,11 +21,23 @@
|
||||
{% if info.updated_date %}· 최근 수정 {{ info.updated_date }}{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="cf24-editor-badges">
|
||||
{# 배지 클릭 = 진열/판매 토글. 카페24 조회에 실패했을 때(desc 없음)는 현재 상태를
|
||||
믿을 수 없으므로 누를 수 없는 표시로만 둔다. 실제 전환은 products.html 의
|
||||
JS 가 POST /products/{no}/status 로 처리하고 응답값으로 다시 그린다. #}
|
||||
<div class="cf24-editor-badges" id="cf24-status" data-product-no="{{ product_no }}">
|
||||
{% if desc %}
|
||||
<button type="button" class="erp-badge cf24-badge-btn {{ 'cf24-badge-ok' if info.display else 'cf24-badge-off' }}"
|
||||
data-status-field="display" data-status-on="{{ 1 if info.display else 0 }}"
|
||||
title="클릭하면 진열 상태를 바꿉니다 (카페24에 즉시 반영)">{{ '진열' if info.display else '미진열' }}</button>
|
||||
<button type="button" class="erp-badge cf24-badge-btn {{ 'cf24-badge-ok' if info.selling else 'cf24-badge-off' }}"
|
||||
data-status-field="selling" data-status-on="{{ 1 if info.selling else 0 }}"
|
||||
title="클릭하면 판매 상태를 바꿉니다 (카페24에 즉시 반영)">{{ '판매' if info.selling else '중지' }}</button>
|
||||
{% else %}
|
||||
{% if info.display %}<span class="erp-badge cf24-badge-ok">진열</span>
|
||||
{% else %}<span class="erp-badge cf24-badge-off">미진열</span>{% endif %}
|
||||
{% if info.selling %}<span class="erp-badge cf24-badge-ok">판매</span>
|
||||
{% else %}<span class="erp-badge cf24-badge-off">중지</span>{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user