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

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

@ -31,7 +31,7 @@ from app.logic.screenshots import do_create_screenshot, do_order_screenshots
class CreateScreenshotForm(FlaskForm): class CreateScreenshotForm(FlaskForm):
title = StringField(lazy_gettext("Title/Caption"), [Optional(), Length(-1, 100)]) 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")) submit = SubmitField(lazy_gettext("Save"))
@ -87,7 +87,7 @@ def create_screenshot(package):
form = CreateScreenshotForm() form = CreateScreenshotForm()
if form.validate_on_submit(): if form.validate_on_submit():
try: 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")) return redirect(package.getURL("packages.screenshots"))
except LogicError as e: except LogicError as e:
flash(e.message, "danger") flash(e.message, "danger")

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

@ -16,7 +16,7 @@
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ render_field(form.title) }} {{ 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) }} {{ render_submit_field(form.submit) }}
</form> </form>
{% endblock %} {% endblock %}