product edit: restore no-JS comma tags input in bottom Tags well
CI caught a regression from the Tags-well move (c5d53c0): the no-JS
<input type='text' name='tags'> field that the settings POST handler
reads (views/product.py: 'if "tags" in request.params') was dropped
when the manual-mode block left the parent form.
Restored the field inside the manual_tags_enabled branch and added id
='product-settings-form' to the title/description/visibility form, then
used HTML5 form='product-settings-form' on the input so it lives in the
bottom Tags well visually but submits with Save Settings semantically.
test_product_edit_renders_chip_editor green; full TestProductTagsSpa
class (19 tests) green.
This commit is contained in:
parent
c5d53c084a
commit
6e37c8b233
1 changed files with 17 additions and 5 deletions
|
|
@ -261,7 +261,7 @@
|
|||
</section>
|
||||
|
||||
<section class="product-title-and-description well2 edit-card-full">
|
||||
<form method="post" action="{{ product.absolute_edit_url(request) }}" onsubmit="submit.disabled = true; return true;">
|
||||
<form id="product-settings-form" method="post" action="{{ product.absolute_edit_url(request) }}" onsubmit="submit.disabled = true; return true;">
|
||||
<h3>
|
||||
<span class="edit-card-icon">✎</span>
|
||||
Edit Title, Description, or Visibility
|
||||
|
|
@ -587,10 +587,12 @@
|
|||
Tags
|
||||
</h3>
|
||||
{% if request.manual_tags_enabled %}
|
||||
{# Capability-driven: with JS the chip editor POSTs each add/remove
|
||||
to /p/{id}/tags via AJAX; product_tags.js drops `hidden` once it
|
||||
initialises. Manual-mode no-JS edits are out-of-band (no parent
|
||||
form here) — flip the kill switch only when JS is available. #}
|
||||
{# Capability-driven: no-JS edits the comma `tags` input — it lives
|
||||
outside the settings <form> but submits with it via the HTML5
|
||||
form="product-settings-form" attribute (Save Settings handles the
|
||||
bulk sync, see views/product.py "if 'tags' in request.params"). JS
|
||||
hides this field, swaps in the chip editor, and POSTs each
|
||||
add/remove to /p/{id}/tags via AJAX (product_tags.js). #}
|
||||
<div class="product-tags-field"
|
||||
data-product-tags
|
||||
data-product-tags-url="/p/{{ product.id }}/tags">
|
||||
|
|
@ -615,6 +617,16 @@
|
|||
</div>
|
||||
<div class="tag-chip-flash" data-tag-chip-flash aria-live="polite"></div>
|
||||
</div>
|
||||
|
||||
{# No-JS fallback / sync target for the chip editor. The HTML5
|
||||
`form` attribute attaches this input to the Save Settings form
|
||||
above so the no-JS comma flow still works from a separate well. #}
|
||||
<label for="tags_input">Tags</label>
|
||||
<input type="text" name="tags" id="tags_input"
|
||||
form="product-settings-form"
|
||||
maxlength="512"
|
||||
placeholder="e.g. math, seasonal, valentines"
|
||||
value="{% for t in request.product.tags %}{{ t.name }}{% if not loop.last %}, {% endif %}{% endfor %}" />
|
||||
<small class="note-text">
|
||||
Tags group this product on your shop's home page. Manage all tags at
|
||||
<a href="/s/{{ request.shop.id }}/tags" class="shop-theme-link-color">your tag editor</a>.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue