]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/macros/package_approval.html
acabe98e78e9a93d366fb4dd1ee969de4787430c
[cheatdb.git] / app / templates / macros / package_approval.html
1 {% macro render_banners(package, current_user, topic_error, topic_error_lvl, similar_topics) -%}
2
3 <div class="row mb-4">
4         <span class="col">
5                 State: <strong>{{ package.state.value }}</strong>
6         </span>
7
8         {% for state in package.getNextStates(current_user) %}
9                 <form class="col-auto"  method="post" action="{{ package.getSetStateURL(state) }}">
10                         <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
11                         <input class="btn btn-sm btn-secondary" type="submit" value="{{ state.verb() }}" />
12                 </form>
13         {% endfor %}
14 </div>
15
16 {% set level = "warning" %}
17 {% if package.releases.count() == 0 %}
18         {% set message %}
19                 <h4 class="alert-heading">Release Required</h4>
20                 {% if package.checkPerm(current_user, "MAKE_RELEASE") %}
21                         <p>You need to create a release before this package can be approved.</p>
22                         <p>
23                                 A release is a single downloadable version of your {{ package.type.value | lower }}.
24                                 You need to create releases even if you use a rolling release development cycle,
25                                 as Minetest needs them to check for updates.
26                         </p>
27                         <a class="btn" href="{{ package.getCreateReleaseURL() }}">Create Release</a>
28                 {% else %}
29                         A release is required before this package can be approved.
30                 {% endif %}
31         {% endset %}
32 {% elif (package.type == package.type.GAME or package.type == package.type.TXP) and package.screenshots.count() == 0 %}
33         {% set message = "You need to add at least one screenshot." %}
34
35 {% elif topic_error_lvl == "danger" %}
36 {% elif package.state == package.state.READY_FOR_REVIEW and ("Other" in package.license.name or "Other" in package.media_license.name) %}
37         {% set message = "Please wait for the license to be added to CDB." %}
38
39 {% else %}
40         {% set level = "info" %}
41         {% set message %}
42                 {% if package.screenshots.count() == 0 %}
43                         <b>You should add at least one screenshot, but this isn't required.</b><br />
44                 {% endif %}
45
46                 {% if package.state == package.state.READY_FOR_REVIEW %}
47                         {% if not package.getDownloadRelease() %}
48                                 Please wait for the release to be approved.
49                         {% elif package.checkPerm(current_user, "APPROVE_NEW") %}
50                                 You can now approve this package if you're ready.
51                         {% else %}
52                                 Please wait for the package to be approved.
53                         {% endif %}
54                 {% else %}
55                         {% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
56                                 You can now submit this package for approval if you're ready.
57                         {% else %}
58                                 This package can be submitted for approval when ready.
59                         {% endif %}
60                 {% endif %}
61         {% endset %}
62 {% endif %}
63
64 {% if message %}
65         <div class="alert alert-{{ level }}">
66                 <span class="icon_message"></span>
67
68                 {{ message | safe }}
69
70                 <div style="clear: both;"></div>
71         </div>
72 {% endif %}
73
74 {% if topic_error %}
75         <div class="alert alert-{{ topic_error_lvl }}">
76                 <span class="icon_message"></span>
77                 {{ topic_error | safe }}
78                 <div style="clear: both;"></div>
79         </div>
80 {% endif %}
81
82 {% if similar_topics %}
83         <div class="alert alert-warning">
84                 Please make sure that this package has the right to
85                 the name '{{ package.name }}'.
86                 See the
87                 <a href="/policy_and_guidance/">Inclusion Policy</a>
88                 for more info.
89         </div>
90 {% endif %}
91
92 {% if not package.review_thread and (package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW")) %}
93         <div class="alert alert-secondary">
94                 <a class="float-right btn btn-sm btn-secondary" href="{{ url_for('threads.new', pid=package.id, title='Package approval comments') }}">Open Thread</a>
95
96                 Privately ask a question or give feedback
97                 <div style="clear:both;"></div>
98         </div>
99 {% endif %}
100
101 {% endmacro %}