PALETTE: swatch preview + tooltip + OK commit — TDD
Clicking a swatch instantly swaps the body palette class for a live preview; OK commits silently (POST, no reload); click-elsewhere or 10 s auto-dismiss reverts. Tooltip portal shows label, shoptalk, lock state. Locked swatches show × (disabled). 20 FTs green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,16 +7,21 @@
|
||||
<div class="palette-scroll">
|
||||
{% for palette in palettes %}
|
||||
<div class="palette-item">
|
||||
<div class="swatch {{ palette.name }}{% if user_palette == palette.name %} active{% endif %}{% if palette.locked %} locked{% endif %}"></div>
|
||||
{% if not palette.locked %}
|
||||
<form method="POST" action="{% url "set_palette" %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" name="palette" value="{{ palette.name }}" class="btn btn-confirm">OK</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<span class="btn btn-disabled">×</span>
|
||||
{% endif %}
|
||||
<div
|
||||
class="swatch {{ palette.name }}{% if user_palette == palette.name %} active{% endif %}{% if palette.locked %} locked{% endif %}"
|
||||
data-palette="{{ palette.name }}"
|
||||
data-label="{{ palette.label }}"
|
||||
data-locked="{{ palette.locked|yesno:'true,false' }}"
|
||||
data-unlocked-date="{% if not palette.locked %}Default{% endif %}"
|
||||
data-shoptalk="Placeholder"
|
||||
>
|
||||
{% if not palette.locked %}
|
||||
<button type="button" class="btn btn-confirm palette-ok" hidden>OK</button>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-disabled palette-ok" hidden>×</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<script>
|
||||
window.onload = () => {
|
||||
initialize("#id_text");
|
||||
bindPaletteForms();
|
||||
bindPaletteSwatches();
|
||||
bindPaletteWheel();
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user