Rename fileUpload -> file_upload

This commit is contained in:
rubenwardy 2022-08-09 17:51:17 +01:00
parent 0b92d43871
commit bae1df2e8d
4 changed files with 12 additions and 12 deletions

@ -49,11 +49,11 @@ def get_mt_releases(is_max):
class CreatePackageReleaseForm(FlaskForm):
title = StringField(lazy_gettext("Title"), [InputRequired(), Length(1, 30)])
uploadOpt = RadioField(lazy_gettext("Method"), choices=[("upload", lazy_gettext("File Upload"))], default="upload")
vcsLabel = StringField(lazy_gettext("Git reference (ie: commit hash, branch, or tag)"), default=None)
fileUpload = FileField(lazy_gettext("File Upload"))
min_rel = QuerySelectField(lazy_gettext("Minimum Minetest Version"), [InputRequired()],
title = StringField(lazy_gettext("Title"), [InputRequired(), Length(1, 30)])
uploadOpt = RadioField(lazy_gettext("Method"), choices=[("upload", lazy_gettext("File Upload"))], default="upload")
vcsLabel = StringField(lazy_gettext("Git reference (ie: commit hash, branch, or tag)"), default=None)
file_upload = FileField(lazy_gettext("File Upload"))
min_rel = QuerySelectField(lazy_gettext("Minimum Minetest Version"), [InputRequired()],
query_factory=lambda: get_mt_releases(False), get_pk=lambda a: a.id, get_label=lambda a: a.name)
max_rel = QuerySelectField(lazy_gettext("Maximum Minetest Version"), [InputRequired()],
query_factory=lambda: get_mt_releases(True), get_pk=lambda a: a.id, get_label=lambda a: a.name)
@ -97,7 +97,7 @@ def create_release(package):
form.vcsLabel.data, form.min_rel.data.getActual(), form.max_rel.data.getActual())
else:
rel = do_create_zip_release(current_user, package, form.title.data,
form.fileUpload.data, form.min_rel.data.getActual(), form.max_rel.data.getActual())
form.file_upload.data, form.min_rel.data.getActual(), form.max_rel.data.getActual())
return redirect(url_for("tasks.check", id=rel.task_id, r=rel.getEditURL()))
except LogicError as e:
flash(e.message, "danger")

@ -31,7 +31,7 @@ from app.logic.screenshots import do_create_screenshot, do_order_screenshots
class CreateScreenshotForm(FlaskForm):
title = StringField(lazy_gettext("Title/Caption"), [Optional(), Length(-1, 100)])
fileUpload = FileField(lazy_gettext("File Upload"), [InputRequired()])
file_upload = FileField(lazy_gettext("File Upload"), [InputRequired()])
submit = SubmitField(lazy_gettext("Save"))
@ -87,7 +87,7 @@ def create_screenshot(package):
form = CreateScreenshotForm()
if form.validate_on_submit():
try:
do_create_screenshot(current_user, package, form.title.data, form.fileUpload.data, False)
do_create_screenshot(current_user, package, form.title.data, form.file_upload.data, False)
return redirect(package.getURL("packages.screenshots"))
except LogicError as e:
flash(e.message, "danger")

@ -51,7 +51,7 @@
pattern="[A-Za-z0-9/._-]+") }}
{% endif %}
{{ render_field(form.fileUpload, fieldclass="form-control-file", class_="mt-3", accept=".zip") }}
{{ render_field(form.file_upload, fieldclass="form-control-file", class_="mt-3", accept=".zip") }}
<p>
{{ _("Take a look at the <a href='/help/package_config/'>Package Configuration and Releases Guide</a> for
@ -94,10 +94,10 @@
<script>
function check_opt() {
if ($("input[name=uploadOpt]:checked").val() == "vcs") {
$("#fileUpload").parent().hide();
$("#file_upload").parent().hide();
$("#vcsLabel").parent().show();
} else {
$("#fileUpload").parent().show();
$("#file_upload").parent().show();
$("#vcsLabel").parent().hide();
}
}

@ -16,7 +16,7 @@
{{ form.hidden_tag() }}
{{ render_field(form.title) }}
{{ render_field(form.fileUpload, fieldclass="form-control-file", accept="image/png,image/jpeg") }}
{{ render_field(form.file_upload, fieldclass="form-control-file", accept="image/png,image/jpeg") }}
{{ render_submit_field(form.submit) }}
</form>
{% endblock %}