contentdb/app/templates/macros/releases.html
2023-06-19 21:57:54 +01:00

107 lines
3.1 KiB
HTML

{% macro render_releases_edit(releases, package) %}
{% for rel in releases %}
<a class="list-group-item list-group-item-action" href="{{ rel.get_edit_url() }}">
{{ rel.title }}
<span class="text-muted ml-1">
{% if rel.min_rel and rel.max_rel %}
[MT {{ rel.min_rel.name }}-{{ rel.max_rel.name }}]
{% elif rel.min_rel %}
[MT {{ rel.min_rel.name }}+]
{% elif rel.max_rel %}
[MT &le;{{ rel.max_rel.name }}]
{% endif %}
</span>
<br />
<small style="color:#999;">
{% if rel.commit_hash %}
[{{ rel.commit_hash | truncate(5, end='') }}]
{% endif %}
{{ _("created %(date)s", date=rel.releaseDate | date) }}.
</small>
</a>
{% endfor %}
{% endmacro %}
{% macro render_releases_download(releases, package, current_user) %}
{% for rel in releases %}
{% if rel.approved or package.check_perm(current_user, "MAKE_RELEASE") or rel.check_perm(current_user, "APPROVE_RELEASE") %}
<a class="list-group-item list-group-item-action" href="{{ rel.get_download_url() }}">
{{ rel.title }}
<span class="text-muted ml-1">
{% if rel.min_rel and rel.max_rel %}
[MT {{ rel.min_rel.name }}-{{ rel.max_rel.name }}]
{% elif rel.min_rel %}
[MT {{ rel.min_rel.name }}+]
{% elif rel.max_rel %}
[MT &le;{{ rel.max_rel.name }}]
{% endif %}
</span>
<br />
<small style="color:#999;">
{% if rel.commit_hash %}
[{{ rel.commit_hash | truncate(5, end='') }}]
{% endif %}
{{ _("created %(date)s", date=rel.releaseDate | date) }}.
</small>
</a>
{% endif %}
{% endfor %}
{% endmacro %}
{% macro render_releases(releases, package, current_user) -%}
{% for rel in releases %}
<div class="list-group-item">
<a class="btn btn-sm btn-primary float-right" href="{{ rel.get_edit_url() }}">
{% if not rel.task_id and not rel.approved and rel.check_perm(current_user, "APPROVE_RELEASE") %}
{{ _("Edit / Approve") }}
{% else %}
{{ _("Edit") }}
{% endif %}
</a>
{% if not rel.approved %}<i>{% endif %}
<a href="{{ rel.get_download_url() }}" rel="nofollow" download="{{ rel.get_download_filename() }}">
{{ rel.title }}
</a>
<span class="text-muted ml-1">
{% if rel.min_rel and rel.max_rel %}
[MT {{ rel.min_rel.name }}-{{ rel.max_rel.name }}]
{% elif rel.min_rel %}
[MT {{ rel.min_rel.name }}+]
{% elif rel.max_rel %}
[MT &le;{{ rel.max_rel.name }}]
{% endif %}
</span>
<br>
<small style="color:#999;">
{% if rel.commit_hash %}
[{{ rel.commit_hash | truncate(5, end='') }}]
{% endif %}
{{ _("created %(date)s", date=rel.releaseDate | date) }}.
</small>
{% if (package.check_perm(current_user, "MAKE_RELEASE") or rel.check_perm(current_user, "APPROVE_RELEASE")) and rel.task_id %}
<a href="{{ url_for('tasks.check', id=rel.task_id, r=package.get_url('packages.view')) }}">
{{ _("Importing...") }}
</a>
{% elif not rel.approved %}
{{ _("Waiting for approval.") }}
{% endif %}
{% if not rel.approved %}</i>{% endif %}
</div>
{% else %}
<div class="list-group-item">
{{ _("No releases available.") }}
</div>
{% endfor %}
{% endmacro %}