mirror of
https://github.com/minetest/contentdb.git
synced 2025-03-14 14:22:30 +01:00
Hide create release fields depending on radio buttons
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
{{ render_field(form.vcsLabel, class_="mt-3") }}
|
||||
{% endif %}
|
||||
|
||||
{{ render_field(form.fileUpload, fieldclass="form-control-file") }}
|
||||
{{ render_field(form.fileUpload, fieldclass="form-control-file", class_="mt-3") }}
|
||||
|
||||
<div class="row">
|
||||
{{ render_field(form.min_rel, class_="col-sm-6") }}
|
||||
@ -41,4 +41,17 @@
|
||||
|
||||
{% block scriptextra %}
|
||||
<script src="/static/release_minmax.js?v=1"></script>
|
||||
<script>
|
||||
function check_opt() {
|
||||
if ($("input[name=uploadOpt]:checked").val() == "vcs") {
|
||||
$("#fileUpload").parent().hide();
|
||||
$("#vcsLabel").parent().show();
|
||||
} else {
|
||||
$("#fileUpload").parent().show();
|
||||
$("#vcsLabel").parent().hide();
|
||||
}
|
||||
}
|
||||
$("input[name=uploadOpt]").change(check_opt);
|
||||
check_opt();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -240,6 +240,7 @@
|
||||
<div class="float-right">
|
||||
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
|
||||
<a href="{{ package.getBulkReleaseURL() }}">bulk</a>
|
||||
|
|
||||
<a href="{{ package.getCreateReleaseURL() }}">+</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -43,7 +43,7 @@ def get_mt_releases(is_max):
|
||||
class CreatePackageReleaseForm(FlaskForm):
|
||||
title = StringField("Title", [InputRequired(), Length(1, 30)])
|
||||
uploadOpt = RadioField ("Method", choices=[("upload", "File Upload")], default="upload")
|
||||
vcsLabel = StringField("VCS Commit or Branch", default="master")
|
||||
vcsLabel = StringField("VCS Commit Hash, Branch, or Tag", default="master")
|
||||
fileUpload = FileField("File Upload")
|
||||
min_rel = QuerySelectField("Minimum Minetest Version", [InputRequired()],
|
||||
query_factory=lambda: get_mt_releases(False), get_pk=lambda a: a.id, get_label=lambda a: a.name)
|
||||
|
Reference in New Issue
Block a user