feat(cafe24): 진열중·판매중 기본 체크 + 분리 상품 모바일 동시 반영 선택

1) 필터 기본값

진열중·판매중을 기본 체크로 바꿨다. 체크박스는 해제 상태면 아무 값도 보내지 않아
기본값이 체크면 "사용자가 일부러 해제함"을 구분할 수 없다. 그래서 폼에 표식(f=1)을
넣어, 표식이 없으면 첫 방문(기본값), 있으면 실제 체크 상태를 따르게 했다. 표식은
목록 링크·적용 후 리다이렉트에도 이어 붙어 해제 상태가 유지된다.

2) 분리 상품의 모바일 반영

"소스를 수정하면 PC와 모바일이 같이 수정되는 것 아닌가" 라는 지적대로, PC/모바일
분리 사용 상품은 지금까지 PC 만 바뀌고 있었다(미분리 상품은 원래 함께 반영).

편집기에 「모바일도 함께」 체크박스를 추가했다. 현재 두 내용이 같으면 기본 체크라
그대로 적용하면 함께 반영되고, 내용이 다르면 기본 해제하고 경고를 띄운다 — 일부러
다르게 만든 모바일 페이지를 조용히 덮어쓰는 것이 더 큰 사고이기 때문이다. 미분리
상품은 종전처럼 항상 함께 반영하며 체크박스를 보여주지 않는다.

검증: 유닛테스트 51개 통과. 필터 판정을 5가지 경우로 확인(첫 방문·둘 다 체크·하나만·
둘 다 해제·검색 링크) — 둘 다 해제가 f=1 표식으로 유지됨. 편집기 렌더를 3가지
상태로 확인(분리+동일=기본체크, 분리+상이=기본해제+경고, 미분리=체크박스 없음).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 15:41:07 +09:00
parent 9b9bafdf95
commit 34476ba611
8 changed files with 72 additions and 16 deletions
@@ -32,8 +32,15 @@
{% if desc %}
<p class="cf24-note">
{% if desc.separated_mobile %}
<strong>PC/모바일 분리 사용 상품입니다.</strong> 아래 적용은 PC 만 바꿉니다 —
모바일({{ desc.mobile_description | length }}자)은 카페24 관리자에서 따로 반영해야 합니다.
<strong>PC/모바일 분리 사용 상품입니다.</strong>
모바일({{ desc.mobile_description | length }}자)은 아래 <strong>「모바일도 함께」</strong>
체크박스로 같은 내용을 반영할 수 있습니다.
{% if desc.mobile_differs %}
<span class="cf24-warn">지금 모바일 내용이 PC와 달라 기본 해제되어 있습니다</span>
체크하면 모바일이 PC와 같은 내용으로 덮어써집니다.
{% else %}
현재 두 내용이 같아 기본 체크되어 있습니다.
{% endif %}
{% else %}
모바일은 PC와 동일 설정이라 적용 시 <strong>함께 반영</strong>됩니다.
{% endif %}
@@ -55,7 +62,17 @@
<input type="hidden" name="list_query" value="{{ list_query }}" />
<div class="cf24-editor-bar">
<span class="cf24-muted">PC 상세설명 HTML · {{ desc.description | length }}자</span>
<span class="cf24-muted">
PC 상세설명 HTML · {{ desc.description | length }}자
{% if desc.separated_mobile %}
<label class="cf24-check-inline"
title="분리 사용 상품이라 기본적으로 PC 만 바뀝니다. 체크하면 모바일 상세설명도 같은 내용으로 함께 반영합니다.">
<input type="checkbox" name="apply_mobile" value="1"
{% if not desc.mobile_differs %}checked{% endif %} />
모바일도 함께
</label>
{% endif %}
</span>
<span class="cf24-editor-bar-right">
<input class="cf24-memo" type="text" name="memo" maxlength="200"
placeholder="변경 메모 (버전 이력에 남습니다)" />
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814j" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814k" />
{% endblock %}
{% block content %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814j" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814k" />
{% endblock %}
{% block content %}
@@ -23,6 +23,8 @@
{# ── 왼쪽: 상품 목록 ──────────────────────────────────────── #}
<aside class="erp-card cf24-pane cf24-pane-list">
<form class="cf24-filters" method="get" action="/cafe24/" id="cf24-filter-form">
{# 폼이 제출됐음을 알리는 표식. 없으면 체크 해제를 "첫 방문"과 구분할 수 없다. #}
<input type="hidden" name="f" value="1" />
{% if selected %}<input type="hidden" name="selected" value="{{ selected }}" />{% endif %}
<input class="cf24-search" type="search" name="q" value="{{ keyword }}"
placeholder="상품명 검색" />
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814j" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814k" />
{% endblock %}
{% block content %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814j" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814k" />
{% endblock %}
{% block content %}