Fix ride category selection and stats field display in moderation submission edit view

This commit is contained in:
pacnpal
2024-11-14 01:24:27 +00:00
parent 30b786d51e
commit da0ee1acfa

View File

@@ -9,11 +9,7 @@
category: '{{ submission.changes.category|default:"" }}', category: '{{ submission.changes.category|default:"" }}',
showCoasterFields: {% if submission.changes.category == 'RC' %}true{% else %}false{% endif %}, showCoasterFields: {% if submission.changes.category == 'RC' %}true{% else %}false{% endif %},
init() { init() {
this.$watch('status', value => {
this.status = value;
});
this.$watch('category', value => { this.$watch('category', value => {
this.category = value;
this.showCoasterFields = value === 'RC'; this.showCoasterFields = value === 'RC';
}); });
} }
@@ -167,7 +163,7 @@
hx-target="#submission-{{ submission.id }}" hx-target="#submission-{{ submission.id }}"
class="grid grid-cols-1 gap-3 md:grid-cols-2"> class="grid grid-cols-1 gap-3 md:grid-cols-2">
{% for field, value in submission.changes.items %} {% for field, value in submission.changes.items %}
{% if field != 'model_name' %} {% if field != 'model_name' and field != 'stats' %}
<div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50" <div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50"
{% if field == 'post_closing_status' %}x-show="status === 'CLOSING'"{% endif %} {% if field == 'post_closing_status' %}x-show="status === 'CLOSING'"{% endif %}
{% if field == 'closing_date' %}x-show="['CLOSING', 'SBNO', 'CLOSED_PERM', 'DEMOLISHED', 'RELOCATED'].includes(status)"{% endif %}> {% if field == 'closing_date' %}x-show="['CLOSING', 'SBNO', 'CLOSED_PERM', 'DEMOLISHED', 'RELOCATED'].includes(status)"{% endif %}>
@@ -183,14 +179,6 @@
<option value="{{ choice.0 }}" {% if choice.0 == value %}selected{% endif %}>{{ choice.1 }}</option> <option value="{{ choice.0 }}" {% if choice.0 == value %}selected{% endif %}>{{ choice.1 }}</option>
{% endfor %} {% endfor %}
</select> </select>
<div id="coaster-fields-{{ submission.id }}"
class="mt-4"
x-show="showCoasterFields"
x-cloak>
{% if value == 'RC' %}
{% include 'moderation/partials/coaster_fields.html' with stats=submission.changes.stats %}
{% endif %}
</div>
{% elif field == 'status' %} {% elif field == 'status' %}
<select name="{{ field }}" <select name="{{ field }}"
x-model="status" x-model="status"
@@ -215,7 +203,6 @@
:required="status === 'CLOSING'" :required="status === 'CLOSING'"
{% endif %}> {% endif %}>
{% else %} {% else %}
<!-- Keep existing field implementations -->
{% if field == 'park' %} {% if field == 'park' %}
<div class="relative space-y-2"> <div class="relative space-y-2">
<input type="text" <input type="text"
@@ -341,6 +328,13 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<!-- Coaster Fields -->
<div x-show="showCoasterFields"
x-cloak
class="col-span-2">
{% include 'moderation/partials/coaster_fields.html' with stats=submission.changes.stats %}
</div>
<div class="col-span-2 p-4 border rounded-lg bg-blue-50 dark:bg-blue-900/30 border-blue-200/50 dark:border-blue-700/50"> <div class="col-span-2 p-4 border rounded-lg bg-blue-50 dark:bg-blue-900/30 border-blue-200/50 dark:border-blue-700/50">
<label class="block mb-2 text-sm font-medium text-blue-900 dark:text-blue-300"> <label class="block mb-2 text-sm font-medium text-blue-900 dark:text-blue-300">
Notes (required): Notes (required):