contentdb/app/templates/packages/create_edit.html
2024-07-03 18:07:12 +01:00

157 lines
6.3 KiB
HTML

{% extends "packages/package_base.html" %}
{% block title %}
{% if package %}
{{ _("Edit - %(title)s", title=package.title) }}
{% if not package and author != current_user %}
for {{ author.display_name }}
{% endif %}
{% else %}
{{ _("Create Package") }}
{% endif %}
{% endblock %}
{% from "macros/forms.html" import render_field, render_field_prefix_button, render_submit_field, form_scripts,
render_multiselect_field, package_lists, easymde_scripts %}
{% block scriptextra %}
{{ form_scripts() }}
{{ easymde_scripts() }}
{% if enable_wizard %}
<script src="/static/js/polltask.js"></script>
<script src="/static/js/package_create.js"></script>
{% endif %}
<script src="/static/js/package_edit.js?v=3"></script>
{% endblock %}
{% block content %}
{% if package %}
<h2 class="mt-0">{{ _("Edit Details") }}</h2>
{% else %}
<h2 class="mt-0">
{{ _("Create Package") }}
{% if author != current_user %}
for {{ author.display_name }}
{% endif %}
</h2>
{% endif %}
{% if not package %}
<div class="alert alert-info">
<a class="float-end btn btn-sm btn-default" href="{{ url_for('flatpage', path='policy_and_guidance') }}" target="_blank">{{ _("View") }}</a>
{{ _("Have you read the Package Inclusion Policy and Guidance yet?") }}
</div>
{% else %}
<div class="alert alert-secondary">
<a class="float-end btn btn-sm btn-default" href="/help/package_config/#cdbjson" target="_blank">{{ _("Read more") }}</a>
{{ _("You can include a .cdb.json file in your package to update these details automatically.") }}
</div>
{% endif %}
<noscript>
<div class="alert alert-warning">
{{ _("JavaScript is needed to improve the user interface, and is needed for features
such as finding metadata from git, and autocompletion.") }}
</div>
</noscript>
{{ package_lists() }}
<form method="POST" action="" class="tableform" data-author="{{ author.username }}">
{{ form.hidden_tag() }}
<fieldset class="pkg_meta">
<legend>{{ _("Package") }}</legend>
<div class="row">
{% if package and package.approved %}
{{ render_field(form.type, class_="pkg_meta col-sm-3", disabled=True) }}
<input type="hidden" name="type" value="{{ form.type.data.to_name() }}">
{% else %}
{{ render_field(form.type, class_="pkg_meta col-sm-3") }}
{% endif %}
{{ render_field(form.title, class_="pkg_meta col-sm-5") }}
{% if package and package.approved and not package.check_perm(current_user, "CHANGE_NAME") %}
{{ render_field(form.name, class_="pkg_meta col-sm-4",
readonly=True, hint=_("You need to unpublish the package to change the name.")) }}
{% else %}
{{ render_field(form.name, class_="pkg_meta col-sm-4", pattern="[a-z0-9_]+", title=_("Lower case letters (a-z), digits (0-9), and underscores (_) only")) }}
{% endif %}
</div>
{{ render_field(form.short_desc, class_="pkg_meta") }}
<p class="form-text text-warning d-none" id="short_desc_mods">
{{ _("Tip: Don't include <i>Minetest</i>, <i>mod</i>, or <i>modpack</i> anywhere in the short description. It is unnecessary and wastes characters.") }}
</p>
{{ render_field(form.dev_state, class_="pkg_meta", hint=_("Please choose 'Work in Progress' if your package is unstable, and shouldn't be recommended to all players")) }}
{{ render_multiselect_field(form.tags, class_="pkg_meta") }}
{{ render_multiselect_field(form.content_warnings, class_="pkg_meta") }}
<div class="pkg_meta row">
{{ render_field(form.license, class_="not_txp col-sm-6") }}
{{ render_field(form.media_license, class_="col-sm-6", hint=_("If there is no media, set the Media License to the same as the License.")) }}
</div>
{{ render_field(form.desc, class_="pkg_meta", fieldclass="form-control markdown") }}
<p class="form-text text-danger d-none" id="desc_page_link">
{{ _("There's no need to link to the package on ContentDB in the long description, the user is already here!") }}
</p>
<p class="form-text text-warning d-none" id="desc_page_topic">
{{ _("There's no need to include the forum topic in the long description, it's already shown on the page.") }}
</p>
<p class="form-text text-warning d-none" id="desc_page_repo">
{{ _("There's no need to include the repository URL in the long description, it's already shown on the page.") }}
</p>
<p class="pkg_meta form-text text-muted">
<a href="/help/appealing_page/#long-description" target="_blank">
{{ _("What to write in the long description") }}
</a>
</p>
</fieldset>
<fieldset class="mt-4 mb-5">
<legend class="pkg_meta">{{ _("Repository and Links") }}</legend>
<div class="pkg_wiz_1 d-none">
<h3>{{ _("Do you have a Git repository?") }}</h3>
<p>
<strong>{{ _("Having a repository is optional") }}.</strong>
</p>
<p>
{{ _("If you do have a repository, enter the URL below. Otherwise, leave blank and click skip.") }}
</p>
</div>
{{ render_field(form.website, class_="pkg_meta") }}
{{ render_field(form.repo, class_="pkg_repo", hint=_("HTTP URL to a Git, Mercurial, or other repository")) }}
<div class="pkg_wiz_1 d-none">
<a id="pkg_wiz_1_next" class="btn btn-primary">{{ _("Next (Autoimport)") }}</a>
<a id="pkg_wiz_1_skip" class="btn btn-secondary ms-2">{{ _("Skip") }}</a>
</div>
<div class="pkg_wiz_2 d-none">
{{ _("Importing... (This may take a while)") }}
</div>
{{ render_field(form.issueTracker, class_="pkg_meta", hint=_("Where should users report issues?")) }}
{{ render_field_prefix_button(form.forums, class_="pkg_meta",
pattern="[0-9]+",
prefix="forum.minetest.net/viewtopic.php?t=",
placeholder=_("Paste a forum topic URL"),
has_view=True) }}
{{ render_field(form.video_url, class_="pkg_meta", hint=_("YouTube videos will be shown in an embed.")) }}
{{ render_field(form.donate_url, class_="pkg_meta", hint=_("If blank, the author's donation URL will be used instead.")) }}
{{ render_field(form.translation_url, class_="pkg_meta", hint=_("How can users translate your package? ie: weblate URL or a help page")) }}
</fieldset>
{% if not package %}
<p class="pkg_meta text-muted">
{{ _("You need to save a draft before you can add releases and screenshots. You'll be able to edit the package again before submitting for approval.") }}
</p>
{% endif %}
<div class="pkg_meta">{{ render_submit_field(form.submit) }}</div>
</form>
{% endblock %}