{% macro render_banners(package, current_user, topic_error, topic_error_lvl, conflicting_modnames) -%}
{{ _("State") }}: {{ package.state.value }} {% for state in package.getNextStates(current_user) %}
{% endfor %}
{% set level = "warning" %} {% if package.releases.filter_by(task_id=None).count() == 0 %} {% set message %} {% if package.checkPerm(current_user, "MAKE_RELEASE") %} {% if package.update_config %} {{ _("Create release") }} {% else %} {{ _("Set up releases") }} {% endif %} {% if package.releases.count() == 0 %} {{ _("You need to create a release before this package can be approved.") }} {% else %} {{ _("Release is still importing, or has an error.") }} {% endif %} {% else %} {{ _("A release is required before this package can be approved.") }} {% endif %} {% endset %} {% elif package.screenshots.count() == 0 %} {% set message = _("You need to add at least one screenshot.") %} {% elif package.getMissingHardDependenciesQuery().count() > 0 %} {% set deps = package.getMissingHardDependencies() | join(", ") %} {% set message = _("The following hard dependencies need to be added to ContentDB first: %(deps)s", deps=deps) %} {% 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 %} {{ _("You should add at least one screenshot, but this isn't required.") }}
{% 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 %}
{{ message | safe }}
{% endif %} {% if topic_error %}
{{ topic_error | safe }}
{% endif %} {% if conflicting_modnames %}
More info {% if conflicting_modnames | length > 4 %} {{ _("Please make sure that this package has the right to the names it uses.") }} {% else %} {{ _("Please make sure that this package has the right to the names %(names)s", names=conflicting_modnames | join(", ")) }}. {% endif %}
{% endif %} {% if not package.review_thread and (package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW")) %}
{{ _("Open Thread") }} {{ _("Package approval thread") }}: {{ _("You can open a thread if you have a question for the approver or package author.") }}
{% endif %} {% endmacro %}