mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-09 14:37:36 +01:00
Add title and ref query args to create release
This commit is contained in:
parent
fe2acddb5b
commit
c6d39fcba3
@ -72,8 +72,12 @@ def create_release(package):
|
||||
form = CreatePackageReleaseForm()
|
||||
if package.repo is not None:
|
||||
form["uploadOpt"].choices = [("vcs", "Import from Git"), ("upload", "Upload .zip file")]
|
||||
if request.method != "POST":
|
||||
if request.method == "GET":
|
||||
form["uploadOpt"].data = "vcs"
|
||||
form.vcsLabel.data = request.args.get("ref")
|
||||
|
||||
if request.method == "GET":
|
||||
form.title.data = request.args.get("title")
|
||||
|
||||
if form.validate_on_submit():
|
||||
if form["uploadOpt"].data == "vcs":
|
||||
|
@ -505,9 +505,9 @@ class Package(db.Model):
|
||||
return url_for("packages.screenshots",
|
||||
author=self.author.username, name=self.name)
|
||||
|
||||
def getCreateReleaseURL(self):
|
||||
def getCreateReleaseURL(self, **kwargs):
|
||||
return url_for("packages.create_release",
|
||||
author=self.author.username, name=self.name)
|
||||
author=self.author.username, name=self.name, **kwargs)
|
||||
|
||||
def getBulkReleaseURL(self):
|
||||
return url_for("packages.bulk_change_release",
|
||||
|
@ -36,13 +36,22 @@ def domain(url):
|
||||
def date(value):
|
||||
return value.strftime("%Y-%m-%d")
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
def full_datetime(value):
|
||||
return value.strftime("%Y-%m-%d %H:%M") + " UTC"
|
||||
|
||||
@app.template_filter()
|
||||
def datetime(value):
|
||||
delta = dt.utcnow() - value
|
||||
if delta.days == 0:
|
||||
return gettext("%(delta)s ago", delta=format_timedelta(value))
|
||||
else:
|
||||
return value.strftime("%Y-%m-%d %H:%M") + " UTC"
|
||||
return full_datetime(value)
|
||||
|
||||
@app.template_filter()
|
||||
def isodate(value):
|
||||
return value.strftime("%Y-%m-%d")
|
||||
|
||||
@app.template_filter()
|
||||
def timedelta(value):
|
||||
|
@ -1,6 +1,7 @@
|
||||
{% macro render_outdated_packages(outdated_packages) -%}
|
||||
<ul class="list-group mt-3">
|
||||
{% for package in outdated_packages %}
|
||||
{% set config = package.update_config %}
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
{% if package %}
|
||||
@ -17,18 +18,20 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="col-sm">
|
||||
{% if package.update_config.trigger == package.update_config.trigger.TAG and package.update_config.last_tag %}
|
||||
{{ _("New tag: %(tag)s", tag=package.update_config.last_tag) }}
|
||||
{% if config.trigger == config.trigger.TAG and config.last_tag %}
|
||||
{{ _("New tag: %(tag)s", tag=config.last_tag) }}
|
||||
{% else %}
|
||||
{{ _("Git repo has commit %(ref)s", ref=package.update_config.last_commit[0:5]) }}
|
||||
{{ _("Git repo has commit %(ref)s", ref=config.last_commit[0:5]) }}
|
||||
{% endif %}
|
||||
<span class="text-muted ml-3">
|
||||
{{ package.update_config.outdated_at | datetime }}
|
||||
{{ config.outdated_at | datetime }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-auto">
|
||||
<a class="btn btn-sm btn-primary mr-2" href="{{ package.getCreateReleaseURL() }}">
|
||||
{% set release_title = config.last_tag or (config.outdated_at | isodate) %}
|
||||
<a class="btn btn-sm btn-primary mr-2"
|
||||
href="{{ package.getCreateReleaseURL(title=release_title, ref=config.last_tag or config.last_commit) }}">
|
||||
<i class="fas fa-plus mr-1"></i>
|
||||
{{ _("Release") }}
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user