]> git.lizzy.rs Git - cheatdb.git/blobdiff - app/templates/packages/view.html
Implement package states for easier reviews
[cheatdb.git] / app / templates / packages / view.html
index 406a0c692e1d1aa36769d0f4bda7d87153bf1019..45079e0ec1d84067897182453d894c8ca07e25a4 100644 (file)
                </div>
        </header>
 
-       <main class="container mt-4">
-               {% if not package.approved %}
-                       <div class="alert alert-warning">
-                               <span class="icon_message"></span>
-                               {% if package.releases.count() == 0 %}
-                                       <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 %}
-
-                               {% elif (package.type == package.type.GAME or package.type == package.type.TXP) and package.screenshots.count() == 0 %}
-                                       You need to add at least one screenshot.
-
-                               {% elif topic_error_lvl == "danger" %}
-                                       Please fix the below topic issue(s).
+       {% if not package.approved %}
+               <aside class="container mt-4">
+                       {% from "macros/package_approval.html" import render_banners %}
+                       {{ render_banners(package, current_user, topic_error, topic_error_lvl, similar_topics) }}
 
-                               {% elif "Other" in package.license.name or "Other" in package.media_license.name %}
-                                       Please wait for the license to be added to CDB.
-
-                               {% else %}
-                                       {% if package.screenshots.count() == 0 %}
-                                               <b>You should add at least one screenshot, but this isn't required.</b><br />
-                                       {% endif %}
-
-                                       {% if not package.getDownloadRelease() %}
-                                               Please wait for the release to be approved.
-                                       {% elif package.checkPerm(current_user, "APPROVE_NEW") %}
-                                               <form class="float-right"  method="post" action="{{ package.getApproveURL() }}">
-                                                       <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                                                       <input class="btn btn-sm btn-warning" type="submit" value="Approve" />
-                                               </form>
-                                               You can now approve this package if you're ready.
-                                       {% else %}
-                                               Please wait for the package to be approved.
-                                       {% endif %}
+                       {% if review_thread and review_thread.checkPerm(current_user, "SEE_THREAD") %}
+                               <h2>{% if review_thread.private %}&#x1f512;{% endif %} {{ review_thread.title }}</h2>
+                               {% if review_thread.private %}
+                                       <p><i>
+                                               This thread is only visible to the package owner and users of
+                                               Editor rank or above.
+                                       </i></p>
                                {% endif %}
-                               <div style="clear: both;"></div>
-                       </div>
 
-                       {% 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 review_thread and (package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW")) %}
-                               <div class="alert alert-info">
-                                       <a class="float-right btn btn-sm btn-info" href="{{ url_for('threads.new', pid=package.id, title='Package approval comments') }}">Open Thread</a>
-
-                                       Privately ask a question or give feedback
-                                       <div style="clear:both;"></div>
-                               </div>
+                               {% from "macros/threads.html" import render_thread %}
+                               {{ render_thread(review_thread, current_user) }}
                        {% endif %}
-               {% endif %}
+               </aside>
+       {% endif %}
 
+       <main class="container mt-4">
                <aside class="float-right ml-4" style="width: 18rem;">
                        <div class="card mb-4">
                                <div class="card-header">
                        {% endif %}
                </aside>
 
-               {% if not package.approved and (package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW")) %}
-                       {% if review_thread %}
-                               <h2>{% if review_thread.private %}&#x1f512;{% endif %} {{ review_thread.title }}</h2>
-                               {% if review_thread.private %}
-                                       <p><i>
-                                               This thread is only visible to the package owner and users of
-                                               Editor rank or above.
-                                       </i></p>
-                               {% endif %}
-
-                               {% from "macros/threads.html" import render_thread %}
-                               {{ render_thread(review_thread, current_user) }}
-                       {% endif %}
-               {% endif %}
-
                <ul class="screenshot_list mb-4">
                        {% for ss in package.screenshots %}
                                {% if ss.approved or package.checkPerm(current_user, "ADD_SCREENSHOTS") %}