contentdb/app/templates/packages/create_edit.html
2021-02-05 14:21:34 +00:00

127 lines
4.8 KiB
HTML

{% extends "base.html" %}
{% block title %}
{{ package.title or "Create Package" }}
{% if not package and author != current_user %}
for {{ author.display_name }}
{% endif %}
{% endblock %}
{% from "macros/forms.html" import render_field, render_field_prefix_button, render_submit_field, form_scripts,
render_multiselect_field, render_mpackage_field, render_deps_field, package_lists %}
{% block scriptextra %}
{{ form_scripts() }}
{% if enable_wizard %}
<script src="/static/libs/url.min.js"></script>
<script src="/static/polltask.js"></script>
<script src="/static/package_create.js?v=4"></script>
{% endif %}
<script src="/static/package_edit.js?v=4"></script>
{% endblock %}
{% block content %}
<h1>{{ _("Create Package") }}</h1>
<div class="alert alert-info">
<a class="float-right btn btn-sm btn-default" href="{{ url_for('flatpage', path='policy_and_guidance') }}">{{ _("View") }}</a>
{{ _("Have you read the Package Inclusion Policy and Guidance yet?") }}
</div>
{% if package and package.checkPerm(current_user, "REIMPORT_META") and package.releases.first() %}
<form class="alert alert-secondary mb-5" method="post" action="{{ package.getUpdateFromReleaseURL() }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input class="btn btn-sm btn-warning float-right" type="submit" value="{{ _('Import') }}" />
<b>{{ _("Reimport meta from latest release.") }}</b>
{{ _("This will override 'provides', 'dependencies', and 'optional_dependencies'.") }}
<div style="clear:both;"></div>
</form>
{% 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.") }}<br />
{{ _("Whilst disabled Javascript may work, it is not officially supported.") }}
</div>
</noscript>
{{ package_lists() }}
<form method="POST" action="" class="tableform">
{{ form.hidden_tag() }}
<fieldset>
<legend>{{ _("Package") }}</legend>
<div class="row">
{{ render_field(form.type, class_="pkg_meta col-sm-2") }}
{{ render_field(form.title, class_="pkg_meta col-sm-7") }}
{% if package and package.approved and not package.checkPerm(current_user, "CHANGE_NAME") %}
{{ render_field(form.name, class_="pkg_meta col-sm-3", readonly=True) }}
{% else %}
{{ render_field(form.name, class_="pkg_meta col-sm-3", 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") }}
{{ 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") }}
</div>
<div class="pkg_meta row">
<div class="not_txp col-sm-6"></div>
<div class="not_txp col-sm-6">{{ _("If there is no media, set the Media License to the same as the License.") }}</div>
</div>
{{ render_field(form.desc, class_="pkg_meta", fieldclass="form-control markdown") }}
</fieldset>
<fieldset class="pkg_meta">
<legend class="not_txp">{{ _("Dependencies") }}</legend>
<p class="alert alert-secondary not_txp">
<span class="fas fa-info pr-1"></span>
{{ _("Note: This information is now updated automatically when creating a release.") }}
</p>
{# {{ render_deps_field(form.harddep_str, class_="not_txp not_game", placeholder="Comma separated list") }}
{{ render_deps_field(form.softdep_str, class_="not_txp not_game", placeholder="Comma separated list") }} #}
</fieldset>
<fieldset class="mt-4">
<legend class="pkg_meta">{{ _("Repository and Links") }}</legend>
<div class="pkg_wiz_1">
<p>{{ _("Enter the repo URL for the package.
If the repo uses git then the metadata will be automatically imported.") }}</p>
<p>{{ _("Leave blank if you don't have a repo. Click skip if the import fails.") }}</p>
</div>
{{ render_field(form.repo, class_="pkg_repo") }}
<div class="pkg_wiz_1">
<a id="pkg_wiz_1_next" class="btn btn-primary">{{ _("Next (Autoimport)") }}</a>
<a id="pkg_wiz_1_skip" class="btn btn-default">{{ _("Skip Autoimport") }}</a>
</div>
<div class="pkg_wiz_2">
{{ _("Importing... (This may take a while)") }}
</div>
{{ render_field(form.website, class_="pkg_meta") }}
{{ render_field(form.issueTracker, class_="pkg_meta") }}
{{ render_field_prefix_button(form.forums, class_="pkg_meta",
pattern="[0-9]+",
prefix=_("forum.minetest.net/viewtopic.php?t="),
placeholder=_("Tip: paste in a forum topic URL")) }}
</fieldset>
<div class="pkg_meta mt-5">{{ render_submit_field(form.submit) }}</div>
</form>
{% endblock %}