mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-24 06:51:29 +01:00
Improve wizard behaviour
This commit is contained in:
parent
f49da74c3a
commit
3dde8c05ad
@ -251,7 +251,7 @@ def delete_release(package, id):
|
|||||||
|
|
||||||
class PackageUpdateConfigFrom(FlaskForm):
|
class PackageUpdateConfigFrom(FlaskForm):
|
||||||
trigger = SelectField("Trigger", [InputRequired()], choices=PackageUpdateTrigger.choices(), coerce=PackageUpdateTrigger.coerce,
|
trigger = SelectField("Trigger", [InputRequired()], choices=PackageUpdateTrigger.choices(), coerce=PackageUpdateTrigger.coerce,
|
||||||
default=PackageUpdateTrigger.COMMIT)
|
default=PackageUpdateTrigger.TAG)
|
||||||
ref = StringField("Branch name", [Optional()], default=None)
|
ref = StringField("Branch name", [Optional()], default=None)
|
||||||
action = SelectField("Action", [InputRequired()], choices=[("notification", "Notification"), ("make_release", "Create Release")], default="make_release")
|
action = SelectField("Action", [InputRequired()], choices=[("notification", "Notification"), ("make_release", "Create Release")], default="make_release")
|
||||||
submit = SubmitField("Save Settings")
|
submit = SubmitField("Save Settings")
|
||||||
@ -270,8 +270,12 @@ def update_config(package):
|
|||||||
return redirect(package.getEditURL())
|
return redirect(package.getEditURL())
|
||||||
|
|
||||||
form = PackageUpdateConfigFrom(obj=package.update_config)
|
form = PackageUpdateConfigFrom(obj=package.update_config)
|
||||||
if request.method == "GET" and package.update_config:
|
if request.method == "GET":
|
||||||
form.action.data = "make_release" if package.update_config.make_release else "notification"
|
if package.update_config:
|
||||||
|
form.action.data = "make_release" if package.update_config.make_release else "notification"
|
||||||
|
elif request.args.get("action") == "notification":
|
||||||
|
form.trigger.data = PackageUpdateTrigger.COMMIT
|
||||||
|
form.action.data = "notification"
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
if form.disable.data:
|
if form.disable.data:
|
||||||
|
@ -513,9 +513,9 @@ class Package(db.Model):
|
|||||||
return url_for("packages.bulk_change_release",
|
return url_for("packages.bulk_change_release",
|
||||||
author=self.author.username, name=self.name)
|
author=self.author.username, name=self.name)
|
||||||
|
|
||||||
def getUpdateConfigURL(self):
|
def getUpdateConfigURL(self, action=None):
|
||||||
return url_for("packages.update_config",
|
return url_for("packages.update_config",
|
||||||
author=self.author.username, name=self.name)
|
author=self.author.username, name=self.name, action=action)
|
||||||
|
|
||||||
def getSetupReleasesURL(self):
|
def getSetupReleasesURL(self):
|
||||||
return url_for("packages.setup_releases",
|
return url_for("packages.setup_releases",
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<p class="mt-5">
|
<p class="mt-5">
|
||||||
<a class="btn btn-primary" href="{{ package.getUpdateConfigURL() }}">Automatically</a>
|
<a class="btn btn-primary" href="{{ package.getUpdateConfigURL() }}">Automatically</a>
|
||||||
<a class="btn btn-secondary ml-2" href="{{ package.getUpdateConfigURL() }}">Manually, enable reminders</a>
|
<a class="btn btn-secondary ml-2" href="{{ package.getUpdateConfigURL(action="notification") }}">Manually, enable reminders</a>
|
||||||
<a class="btn btn-secondary ml-2" href="{{ package.getCreateReleaseURL() }}">Manually, no reminders</a>
|
<a class="btn btn-secondary ml-2" href="{{ package.getCreateReleaseURL() }}">Manually, no reminders</a>
|
||||||
<a class="btn btn-secondary ml-2" href="{{ package.getDetailsURL() }}">Later</a>
|
<a class="btn btn-secondary ml-2" href="{{ package.getDetailsURL() }}">Later</a>
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user