edit page: title at top + preview file as separate column + file log

Layout restructure per fox:
- "Edit Title, Description, or Visibility" rendered first at top of the
  edit grid (full width) via CSS order: 1. Useful info (title, price,
  pricing mode, visibility) is now the primary focus when landing on
  the page.
- "Upload or Replace Preview File" extracted into its own <section
  class="upload-preview well2"> sibling. It sits in the right column
  of the same row as "Upload or Replace Product File" via the natural
  2-col grid flow.
- Visual order: title-and-description → upload-product → upload-preview
  → upload-thumbnails → price-history. Implemented via CSS order
  property so HTML structure stays simple.
- Preview section only renders for digital sellable products (not bundle,
  not physical) — same guard as before but now an explicit conditional
  around the new <section>.

Debug:
- pricing_mode handler now ALSO writes to /tmp/mps-pricing-debug.log
  (world-writable) in addition to the journalctl warning. Lets us read
  POST params on prod without sudo. Will be removed when bug is fixed.

Tests still pass (9 pricing_mode tests).
This commit is contained in:
russell@unturf.com 2026-05-10 19:19:53 -04:00
parent 5cc17a39a3
commit 08b5440cab
No known key found for this signature in database
3 changed files with 34 additions and 10 deletions

View file

@ -1574,6 +1574,19 @@ div.edit-page > section.edit-card-full {
grid-column: 1 / -1;
}
/* Render order on the edit page (CSS order property reorders without
changing HTML source order):
1. Edit Title, Description, or Visibility (full width, top)
2. Upload Product File (left column)
3. Upload Preview File (right column, sibling of Upload Product)
4. Upload Thumbnails (full width)
5. Price History (whatever comes last) */
div.edit-page > section.product-title-and-description { order: 1; }
div.edit-page > section.upload-product-and-preview { order: 2; }
div.edit-page > section.upload-preview { order: 3; }
div.edit-page > section.upload-thumbnails { order: 4; }
div.edit-page > section.price-history { order: 5; }
/* Thumbnails header laid out via .upload-thumbnails-header flex row
above the .upload-thumbnails-grid (see below). */

View file

@ -147,19 +147,19 @@
</form>
{% if product.is_sellable %}
{% endif %}
<hr/>
</section>
{# Preview file: its own card, sits in the right column of the edit grid. #}
{% if not product.is_bundle and not product.is_physical and product.is_sellable %}
<section class="upload-preview well2">
<h3>
<span class="edit-card-icon">&#128250;</span>
Upload or Replace Preview File
</h3>
People may download this file before making a purchase.
<br />
<br />
<p>People may download this file before making a purchase.</p>
{% if "preview" in product.originals %}
<p class="bold-text">Current File: {{ product.originals["preview"] }}</p>
@ -191,11 +191,8 @@
<input type="file" name="file" class="file-input" /> <br />
<input type="submit" name="submit" class="mps-upload" value="Upload Preview" />
</form>
{% endif %}
{% endif %}
</section>
{% endif %}
<section class="upload-thumbnails well2 edit-card-full">

View file

@ -314,6 +314,7 @@ def product_edit(request):
# MPS-20 + MPS-21: pricing_mode + allow_offers (per-product overrides).
if "submit" in request.params:
# TEMPORARY DEBUG: log raw POST params for pricing_mode investigation.
# Writes to /tmp/mps-pricing-debug.log so we can read without sudo.
# Remove once the save defect is diagnosed.
try:
import logging as _logging
@ -329,6 +330,19 @@ def product_edit(request):
)
except Exception:
pass
try:
import time as _time
with open("/tmp/mps-pricing-debug.log", "a") as _f:
_f.write(
f"{_time.time():.3f} product={product.uuid_str} "
f"current={product.pricing_mode} "
f"pricing_mode={request.params.get('pricing_mode')!r} "
f"all_modes={list(request.params.getall('pricing_mode')) if hasattr(request.params, 'getall') else 'no-getall'} "
f"submit={request.params.get('submit')!r} "
f"all_keys={sorted(request.params.keys())}\n"
)
except Exception:
pass
try:
new_mode = int(request.params.get("pricing_mode", product.pricing_mode))
except (TypeError, ValueError):