mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Add warning when max_minetest_version is set to the latest stable
This commit is contained in:
parent
15bde2461e
commit
e5f5313156
@ -7,15 +7,23 @@ window.addEventListener("load", () => {
|
||||
const min = document.getElementById("min_rel");
|
||||
const max = document.getElementById("max_rel");
|
||||
const none = parseInt(document.querySelector("#min_rel option:first-child").value);
|
||||
const warning = document.getElementById("minmax_warning");
|
||||
const latestMax = parseInt(document.querySelector("#max_rel option:last-child").value);
|
||||
const warningMinMax = document.getElementById("minmax_warning");
|
||||
const warningMax = document.getElementById("latest_release");
|
||||
|
||||
function ver_check() {
|
||||
const minv = parseInt(min.value);
|
||||
const maxv = parseInt(max.value);
|
||||
if (minv != none && maxv != none && minv > maxv) {
|
||||
warning.style.display = "block";
|
||||
warningMinMax.classList.remove("d-none");
|
||||
} else {
|
||||
warning.style.display = "none";
|
||||
warningMinMax.classList.add("d-none");
|
||||
}
|
||||
|
||||
if (maxv == latestMax) {
|
||||
warningMax.classList.remove("d-none");
|
||||
} else {
|
||||
warningMax.classList.add("d-none");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,3 +106,11 @@ def abs_url(url):
|
||||
@app.template_filter()
|
||||
def limit(arr, num):
|
||||
return arr[:num]
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
def last_it(it):
|
||||
value = None
|
||||
for x in it:
|
||||
value = x
|
||||
return value
|
||||
|
@ -50,10 +50,19 @@
|
||||
{{ render_field(form.max_rel, class_="col-sm-6") }}
|
||||
</div>
|
||||
|
||||
<p id="minmax_warning" style="color:#f00; display: none;">
|
||||
<p id="minmax_warning" class="text-danger d-none">
|
||||
{{ _("Maximum must be greater than or equal to the minimum!") }}
|
||||
</p>
|
||||
|
||||
<p id="latest_release" class="text-warning d-none">
|
||||
{% set last = form.max_rel | last_it %}
|
||||
<strong>
|
||||
{{ _("Are you sure your package doesn't work on versions after %(version)s?", version=last.label) }}
|
||||
</strong>
|
||||
{{ _("Only set the maximum version if you know that it doesn't work on newer Minetest versions.") }}
|
||||
{{ _("Don't set the maximum version just because you haven't tested it on newer versions.") }}
|
||||
<p>
|
||||
|
||||
<p>
|
||||
{{ _("Set the minimum and maximum Minetest versions supported.
|
||||
This release will be hidden to clients outside of that range. ") }}
|
||||
@ -85,5 +94,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block scriptextra %}
|
||||
<script src="/static/js/release_minmax.js"></script>
|
||||
<script src="/static/js/release_minmax.js?v=2"></script>
|
||||
{% endblock %}
|
||||
|
@ -65,11 +65,19 @@
|
||||
{{ render_field(form.max_rel, class_="col-sm-6") }}
|
||||
</div>
|
||||
|
||||
|
||||
<p id="minmax_warning" style="color:#f00; display: none;">
|
||||
<p id="minmax_warning" class="text-danger d-none">
|
||||
{{ _("Maximum must be greater than or equal to the minimum!") }}
|
||||
</p>
|
||||
|
||||
<p id="latest_release" class="text-warning d-none">
|
||||
{% set last = form.max_rel | last_it %}
|
||||
<strong>
|
||||
{{ _("Are you sure your package doesn't work on versions after %(version)s?", version=last.label) }}
|
||||
</strong>
|
||||
{{ _("Only set the maximum version if you know that it doesn't work on newer Minetest versions.") }}
|
||||
{{ _("Don't set the maximum version just because you haven't tested it on newer versions.") }}
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<i class="fas fa-exclamation-circle me-2"></i>
|
||||
{{ _("The .conf of your package can <a href='/help/package_config/'>set this automatically</a>,
|
||||
@ -79,9 +87,10 @@
|
||||
<p>
|
||||
{{ _("Set the minimum and maximum Minetest versions supported.
|
||||
This release will be hidden to clients outside of that range. ") }}
|
||||
<br />
|
||||
<br>
|
||||
{{ _("Leave both as None if in doubt.") }}
|
||||
</p>
|
||||
|
||||
<p class="mt-5">
|
||||
{{ render_submit_field(form.submit) }}
|
||||
</p>
|
||||
@ -89,6 +98,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block scriptextra %}
|
||||
<script src="/static/js/release_minmax.js"></script>
|
||||
<script src="/static/js/release_minmax.js?v=2"></script>
|
||||
<script src="/static/js/release_new.js"></script>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user