diff options
| author | rubenwardy <rw@rubenwardy.com> | 2020-09-16 17:51:03 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2020-09-16 17:51:03 +0100 |
| commit | 92fb54556ad0409a519c308e7e34b63e11621903 (patch) | |
| tree | 4aec0272914cdb4c9215a961a65e4483c7b18fb4 /app/templates | |
| parent | e81eb9c8d58c193f3480bdab68fa73556c8e83f3 (diff) | |
| download | cheatdb-92fb54556ad0409a519c308e7e34b63e11621903.tar.xz | |
Implement package states for easier reviews
Diffstat (limited to 'app/templates')
| -rw-r--r-- | app/templates/macros/package_approval.html | 101 | ||||
| -rw-r--r-- | app/templates/metapackages/view.html | 2 | ||||
| -rw-r--r-- | app/templates/packages/view.html | 101 | ||||
| -rw-r--r-- | app/templates/todo/list.html | 27 |
4 files changed, 137 insertions, 94 deletions
diff --git a/app/templates/macros/package_approval.html b/app/templates/macros/package_approval.html new file mode 100644 index 0000000..acabe98 --- /dev/null +++ b/app/templates/macros/package_approval.html @@ -0,0 +1,101 @@ +{% 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-secondary" 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> + + Privately ask a question or give feedback + <div style="clear:both;"></div> + </div> +{% endif %} + +{% endmacro %} diff --git a/app/templates/metapackages/view.html b/app/templates/metapackages/view.html index 08a4674..8166350 100644 --- a/app/templates/metapackages/view.html +++ b/app/templates/metapackages/view.html @@ -10,7 +10,7 @@ <h2>Provided By</h2> {% from "macros/packagegridtile.html" import render_pkggrid %} - {{ render_pkggrid(mpackage.packages.filter_by(approved=True, soft_deleted=False).all()) }} + {{ render_pkggrid(mpackage.packages.filter_by(state="APPROVED").all()) }} {% if similar_topics %} <p>Unforuntately, this isn't on ContentDB yet! Here's some forum topics:</p> diff --git a/app/templates/packages/view.html b/app/templates/packages/view.html index 406a0c6..45079e0 100644 --- a/app/templates/packages/view.html +++ b/app/templates/packages/view.html @@ -134,81 +134,27 @@ </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 %}🔒{% 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"> @@ -431,21 +377,6 @@ {% 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 %}🔒{% 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") %} diff --git a/app/templates/todo/list.html b/app/templates/todo/list.html index 24d5289..c3b8118 100644 --- a/app/templates/todo/list.html +++ b/app/templates/todo/list.html @@ -8,21 +8,17 @@ <h2 class="mb-4">Approval Queue</h2> <div class="row"> - {% if canApproveNew and packages %} + {% if canApproveNew and (packages or wip_packages) %} <div class="col-sm-6"> <div class="card"> <h3 class="card-header">Packages</h3> <div class="list-group list-group-flush"> {% for p in packages %} <a href="{{ p.getDetailsURL() }}" class="list-group-item list-group-item-action"> - {% if p.getState() == "thread" %} - <span class="mr-2 badge badge-danger">Thread</span> - {% elif p.getState() == "ready" %} + {% if "Other" in p.license.name or "Other" in p.media_license.name %} + <span class="mr-2 badge badge-info">License</span> + {% else %} <span class="mr-2 badge badge-success">Ready</span> - {% elif p.getState() == "wip" %} - <span class="mr-2 badge badge-warning">WIP</span> - {% elif p.getState() == "license" %} - <span class="mr-2 badge badge-info">WIP</span> {% endif %} {{ p.title }} by {{ p.author.display_name }} @@ -32,6 +28,21 @@ {% endfor %} </div> </div> + + <div class="card mt-5"> + <h3 class="card-header">WIP Packages</h3> + <div class="list-group list-group-flush"> + {% for p in wip_packages %} + <a href="{{ p.getDetailsURL() }}" class="list-group-item list-group-item-action"> + <span class="mr-2 badge badge-warning">{{ p.state.value }}</span> + + {{ p.title }} by {{ p.author.display_name }} + </a> + {% else %} + <li class="list-group-item"><i>No packages need reviewing.</i></li> + {% endfor %} + </div> + </div> </div> {% endif %} |
