aboutsummaryrefslogtreecommitdiff
path: root/app/templates/packages/view.html
blob: e0f03c016f466326d224bf7199bb0a83ee37203f (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
{% extends "base.html" %}

{% block title %}
	{{ package.title }}
{% endblock %}

{% block content %}
	{% if not package.approved %}
		<div class="box box_grey alert alert-warning">
			<span class="icon_message"></span>
			{% if package.releases.count() == 0 %}
				{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
					You need to create a release before this package can be approved.
					<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="button" href="{{ package.getCreateReleaseURL() }}">Create Release</a>
				{% else %}
					A release is required before this package can be approved.
				{% endif %}
			{% elif not package.getDownloadRelease() %}
				Please wait for the release to be approved.
			{% else %}
				{% if package.checkPerm(current_user, "APPROVE_NEW") %}
					You can now approve this package if you're ready.
					<form method="post" action="{{ package.getApproveURL() }}">
						<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
						<input type="submit" value="Approve" />
					</form>
				{% else %}
					This package needs to be approved before it can be found.
				{% endif %}
			{% endif %}
			<div style="clear: both;"></div>
		</div>
	{% endif %}

	<h1>{{ package.title }} by {{ package.author.display_name }}</h1>

	<ul class="screenshot_list">
		{% for ss in package.screenshots %}
			{% if ss.approved or package.checkPerm(current_user, "ADD_SCREENSHOTS") %}
				<li>
					<a href="{% if package.checkPerm(current_user, 'ADD_SCREENSHOTS') %}{{ ss.getEditURL() }}{% else %}{{ ss.url }}{% endif %}">
						<img src="{{ ss.getThumbnailURL() }}" alt="{{ ss.title }}" />
					</a>
				</li>
			{% endif %}
		{% endfor %}
	</ul>

	<aside class="asideright box box_grey">
		<h3>Details</h3>
		<div class="box-body">
			<table>
				<tr>
					<td>Name</td>
					<td>{{ package.name }}</td>
				</tr>
				<tr>
					<td>Author</td>
					<td class="{{ package.author.rank }}">
						<a href="{{ url_for('user_profile_page', username=package.author.username) }}">
							{{ package.author.display_name }}
						</a>
					</td>
				</tr>
				<tr>
					<td>Type</td>
					<td>{{ package.type.value }}</td>
				</tr>
				<tr>
					<td>License</td>
					<td>{{ package.license.name }}</td>
				</tr>
			</table>

			<ul class="buttonset linedbuttonset">
				{% if package.getDownloadRelease() %}<li><a href="{{ package.getDownloadURL() }}">Download</a></li>{% endif %}
				{% if package.repo %}<li><a href="{{ package.repo }}">View Source</a></li>{% endif %}
				{% if package.forums %}<li><a href="https://forum.minetest.net/viewtopic.php?t={{ package.forums }}">Forums</a></li>{% endif %}
				{% if package.issueTracker %}<li><a href="{{ package.issueTracker }}">Issue Tracker</a></li>{% endif %}
				{% if package.website %}<li><a href="{{ package.website }}">Website</a></li>{% endif %}
				{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
					<li><a href="{{ package.getEditURL() }}">Edit</a></li>
					<li><a href="{{ package.getNewScreenshotURL() }}">Add screenshot</a></li>
				{% endif %}
				{% if current_user.is_authenticated %}
					<li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Changes</a></li>
				{% endif %}
				{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
					<li><a href="{{ package.getCreateReleaseURL() }}">Create Release</a></li>
				{% endif %}
				{% if package.checkPerm(current_user, "DELETE_PACKAGE") %}
					<li><a href="{{ package.getDeleteURL() }}">Delete</a></li>
				{% endif %}
			</ul>
		</div>
	</aside>

	<p class="package-short-large">{{ package.shortDesc }}</p>

	{{ package.desc | markdown }}

	<h3>Releases</h3>

	<ul>
		{% for rel in releases %}
			{% if rel.approved or package.checkPerm(current_user, "MAKE_RELEASE") or package.checkPerm(current_user, "APPROVE_RELEASE")  %}
				<li>
					{% if not rel.approved %}<i>{% endif %}

					<a href="{{ rel.url }}">{{ rel.title }}</a>,
					created {{ rel.releaseDate }}.
					{% if rel.task_id %}
						<a href="{{ url_for('check_task', id=rel.task_id, r=package.getDetailsURL()) }}">Importing...</a>
					{% elif not rel.approved %}
						Waiting for approval.
					{% endif %}

					{% if package.checkPerm(current_user, "MAKE_RELEASE") or package.checkPerm(current_user, "APPROVE_RELEASE")  %}
						<a href="{{ rel.getEditURL() }}">Edit
						{% if not rel.task_id and not rel.approved and package.checkPerm(current_user, "APPROVE_RELEASE") %}
							/ Approve
						{% endif %}
						</a>
					{% endif %}

					{% if not rel.approved %}</i>{% endif %}
				</li>
			{% endif %}
		{% else %}
			<li>No releases available.</li>
		{% endfor %}
	</ul>

	<h3>Tags</h3>
	<ul>
		{% for t in package.tags %}
			<li>{{ t.title }}</li>
		{% else %}
			<li>No tags.</li>
		{% endfor %}
	</ul>

	<table class="table-topalign">
		<tr>
			<td>
				<h3>Dependencies</h3>
				<ul>
					{% for p in package.harddeps %}
						<li><a href="{{ p.getDetailsURL() }}">{{ p.title }}</a> by {{ p.author.display_name }}</li>
					{% else %}
						{% if not package.softdeps %}
						<li>No dependencies.</li>
						{% endif %}
					{% endfor %}
					{% for p in package.softdeps %}
						<li><a href="{{ p.getDetailsURL() }}">{{ p.title }}</a> by {{ p.author.display_name }} [optional]</li>
					{% endfor %}
				</ul>
			</td>
			<td>
				<h3>Required by</h3>
				<ul>
					{% for p in package.dependents %}
						<li><a href="{{ p.getDetailsURL() }}">{{ p.title }}</a> by {{ p.author.display_name }}</li>
					{% else %}
						{% if not package.softdependents %}
						<li>No dependents.</li>
						{% endif %}
					{% endfor %}
					{% for p in package.softdependents %}
						<li><a href="{{ p.getDetailsURL() }}">{{ p.title }}</a> by {{ p.author.display_name }} [optional]</li>
					{% endfor %}
				</ul>
			</td>
		</tr>
	</table>

	{% if current_user.is_authenticated or requests %}
		<h3>Edit Requests</h3>

		<ul>
			{% for r in requests %}
				<li>
					<a href="{{ r.getURL() }}">{{ r.title }}</a>
					by
					<a href="{{ url_for('user_profile_page', username=r.author.username) }}">{{ r.author.display_name }}</a>
				</li>
			{% else %}
				<li>No edit requests have been made.</li>
			{% endfor %}
		</ul>
	{% endif %}
{% endblock %}