aboutsummaryrefslogtreecommitdiff
path: root/app/templates/macros/package_approval.html
blob: ef71b315a603c31e346f5b3852f6a67ae2a756be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{% macro render_banners(package, current_user, topic_error, topic_error_lvl, similar_topics) -%}

<div class="row mb-4">
	<span class="col">
		State: <strong>{{ package.state.value }}</strong>
	</span>

	{% for state in package.getNextStates(current_user) %}
		<form class="col-auto"  method="post" action="{{ package.getSetStateURL(state) }}">
			<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
			<input class="btn btn-sm btn-primary" type="submit" value="{{ state.verb() }}" />
		</form>
	{% endfor %}
</div>

{% set level = "warning" %}
{% if package.releases.count() == 0 %}
	{% set message %}
		<h4 class="alert-heading">Release Required</h4>
		{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
			<p>You need to create a release before this package can be approved.</p>
			<p>
				A release is a single downloadable version of your {{ package.type.value | lower }}.
				You need to create releases even if you use a rolling release development cycle,
				as Minetest needs them to check for updates.
			</p>
			<a class="btn" href="{{ package.getCreateReleaseURL() }}">Create Release</a>
		{% else %}
			A release is required before this package can be approved.
		{% endif %}
	{% endset %}
{% elif (package.type == package.type.GAME or package.type == package.type.TXP) and package.screenshots.count() == 0 %}
	{% set message = "You need to add at least one screenshot." %}

{% elif topic_error_lvl == "danger" %}
{% elif package.state == package.state.READY_FOR_REVIEW and ("Other" in package.license.name or "Other" in package.media_license.name) %}
	{% set message = "Please wait for the license to be added to CDB." %}

{% else %}
	{% set level = "info" %}
	{% set message %}
		{% if package.screenshots.count() == 0 %}
			<b>You should add at least one screenshot, but this isn't required.</b><br />
		{% endif %}

		{% if package.state == package.state.READY_FOR_REVIEW %}
			{% if not package.getDownloadRelease() %}
				Please wait for the release to be approved.
			{% elif package.checkPerm(current_user, "APPROVE_NEW") %}
				You can now approve this package if you're ready.
			{% else %}
				Please wait for the package to be approved.
			{% endif %}
		{% else %}
			{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
				You can now submit this package for approval if you're ready.
			{% else %}
				This package can be submitted for approval when ready.
			{% endif %}
		{% endif %}
	{% endset %}
{% endif %}

{% if message %}
	<div class="alert alert-{{ level }}">
		<span class="icon_message"></span>

		{{ message | safe }}

		<div style="clear: both;"></div>
	</div>
{% endif %}

{% if topic_error %}
	<div class="alert alert-{{ topic_error_lvl }}">
		<span class="icon_message"></span>
		{{ topic_error | safe }}
		<div style="clear: both;"></div>
	</div>
{% endif %}

{% if similar_topics %}
	<div class="alert alert-warning">
		Please make sure that this package has the right to
		the name '{{ package.name }}'.
		See the
		<a href="/policy_and_guidance/">Inclusion Policy</a>
		for more info.
	</div>
{% endif %}

{% if not package.review_thread and (package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW")) %}
	<div class="alert alert-secondary">
		<a class="float-right btn btn-sm btn-secondary" href="{{ url_for('threads.new', pid=package.id, title='Package approval comments') }}">Open Thread</a>

		 {{ _("Package review thread") }}:
		 {{ _("You can open a thread if you have a question for the reviewer or package author.") }}
		<div style="clear:both;"></div>
	</div>
{% endif %}

{% endmacro %}