Feb 02 2026: fix star rating when inspection
This commit is contained in:
@@ -449,13 +449,18 @@
|
|||||||
<script>
|
<script>
|
||||||
// ── Rating stars ─────────────────────────────────────────────────────────────
|
// ── Rating stars ─────────────────────────────────────────────────────────────
|
||||||
function setRating(btn) {
|
function setRating(btn) {
|
||||||
const group = btn.closest('.rating-stars');
|
const group = btn.closest('.rating-stars');
|
||||||
const val = parseInt(btn.dataset.val);
|
const clicked = parseInt(btn.dataset.val);
|
||||||
const input = document.getElementById(btn.dataset.target);
|
const current = parseInt(group.dataset.rating || 0);
|
||||||
group.dataset.rating = val;
|
const input = document.getElementById(btn.dataset.target);
|
||||||
if (input) input.value = val;
|
|
||||||
|
// Toggle off: clicking the currently active star clears the rating to 0.
|
||||||
|
const newVal = (clicked === current) ? 0 : clicked;
|
||||||
|
|
||||||
|
group.dataset.rating = newVal;
|
||||||
|
if (input) input.value = newVal;
|
||||||
group.querySelectorAll('button').forEach(b => {
|
group.querySelectorAll('button').forEach(b => {
|
||||||
b.classList.toggle('on', parseInt(b.dataset.val) <= val);
|
b.classList.toggle('on', parseInt(b.dataset.val) <= newVal);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ Pillow
|
|||||||
WTForms
|
WTForms
|
||||||
email-validator
|
email-validator
|
||||||
gunicorn
|
gunicorn
|
||||||
|
pytz
|
||||||
|
|||||||
Reference in New Issue
Block a user