Hide unneeded fields depending on package type

This commit is contained in:
rubenwardy 2018-05-27 22:48:53 +01:00
parent 92daa87db0
commit 44c9f7e58f
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
2 changed files with 25 additions and 4 deletions

View File

@ -0,0 +1,11 @@
// @author rubenwardy
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
$(function() {
$("#type").change(function() {
$(".not_mod, .not_game, .not_txp").show()
$(".not_" + this.value.toLowerCase()).hide()
})
$(".not_mod, .not_game, .not_txp").show()
$(".not_" + $("#type").val().toLowerCase()).hide()
})

View File

@ -8,7 +8,7 @@
{% endblock %}
{% block content %}
<h2>Create Package</h2>
<h1>Create Package</h1>
<script>
meta_packages = [
@ -48,17 +48,26 @@
<form method="POST" action="" class="tableform">
{{ form.hidden_tag() }}
<h2 class="pkg_meta">Package</h2>
{{ render_field(form.name, class_="pkg_meta") }}
{{ render_field(form.title, class_="pkg_meta") }}
{{ render_field(form.shortDesc, class_="pkg_meta") }}
{{ render_field(form.desc, class_="pkg_meta") }}
{{ render_field(form.type, class_="pkg_meta") }}
{{ render_field(form.license, class_="pkg_meta") }}
{{ render_mpackage_field(form.provides_str, class_="pkg_meta", placeholder="Comma separated list") }}
{{ render_deps_field(form.harddep_str, class_="pkg_meta", placeholder="Comma separated list") }}
{{ render_deps_field(form.softdep_str, class_="pkg_meta", placeholder="Comma separated list") }}
{{ render_multiselect_field(form.tags, class_="pkg_meta") }}
<div class="pkg_meta">
<h2 class="not_txp">Dependency Info</h2>
</div>
{{ render_mpackage_field(form.provides_str, class_="pkg_meta not_txp", placeholder="Comma separated list") }}
{{ render_deps_field(form.harddep_str, class_="pkg_meta not_txp not_game", placeholder="Comma separated list") }}
{{ render_deps_field(form.softdep_str, class_="pkg_meta not_txp not_game", placeholder="Comma separated list") }}
<h2 class="pkg_meta">Repository and Links</h2>
<div class="pkg_wiz_1">
<p>Enter the repo URL for the package.
If it's hosted on Github then metadata will automatically be imported.</p>
@ -93,4 +102,5 @@
</div>
</noscript>
{% endif %}
<script src="/static/package_edit.js"></script>
{% endblock %}