mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Disable edit requests
This commit is contained in:
parent
002e6828b6
commit
fa2f17526f
@ -221,6 +221,7 @@ class PackagePropertyKey(enum.Enum):
|
|||||||
desc = "Description"
|
desc = "Description"
|
||||||
type = "Type"
|
type = "Type"
|
||||||
license = "License"
|
license = "License"
|
||||||
|
media_license = "Media License"
|
||||||
tags = "Tags"
|
tags = "Tags"
|
||||||
provides = "Provides"
|
provides = "Provides"
|
||||||
repo = "Repository"
|
repo = "Repository"
|
||||||
|
@ -20,6 +20,40 @@
|
|||||||
<script src="/static/tagselector.js"></script>
|
<script src="/static/tagselector.js"></script>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro package_lists() -%}
|
||||||
|
<script>
|
||||||
|
meta_packages = [
|
||||||
|
{% for m in mpackages %}
|
||||||
|
{# This is safe as name can only contain `[a-z0-9_]` #}
|
||||||
|
{
|
||||||
|
id: "{{ m.name }}",
|
||||||
|
value: "{{ m.name }}",
|
||||||
|
toString: function() { return "{{ m.name }}"; },
|
||||||
|
},
|
||||||
|
{% endfor %}
|
||||||
|
]
|
||||||
|
|
||||||
|
function escape(unsafe) {
|
||||||
|
return unsafe
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/"/g, """)
|
||||||
|
.replace(/'/g, "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
all_packages = meta_packages.slice();
|
||||||
|
|
||||||
|
{% for p in packages %}
|
||||||
|
all_packages.push({
|
||||||
|
id: "{{ p.author.username }}/{{ p.name }}",
|
||||||
|
value: escape({{ p.title | tojson }} + " by " + {{ p.author.display_name | tojson }}),
|
||||||
|
toString: function() { return escape({{ p.title | tojson }} + " by " + {{ p.author.display_name | tojson }} + " only"); },
|
||||||
|
});
|
||||||
|
{% endfor %}
|
||||||
|
</script>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro render_multiselect_field(field, label=None, label_visible=true, right_url=None, right_label=None) -%}
|
{% macro render_multiselect_field(field, label=None, label_visible=true, right_url=None, right_label=None) -%}
|
||||||
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
|
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
|
||||||
{% if field.type != 'HiddenField' and label_visible %}
|
{% if field.type != 'HiddenField' and label_visible %}
|
||||||
|
@ -10,40 +10,10 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Create Package</h1>
|
<h1>Create Package</h1>
|
||||||
|
|
||||||
<script>
|
|
||||||
meta_packages = [
|
|
||||||
{% for m in mpackages %}
|
|
||||||
{# This is safe as name can only contain `[a-z0-9_]` #}
|
|
||||||
{
|
|
||||||
id: "{{ m.name }}",
|
|
||||||
value: "{{ m.name }}",
|
|
||||||
toString: function() { return "{{ m.name }}"; },
|
|
||||||
},
|
|
||||||
{% endfor %}
|
|
||||||
]
|
|
||||||
|
|
||||||
function escape(unsafe) {
|
{% from "macros/forms.html" import render_field, render_submit_field, form_includes, render_multiselect_field, render_mpackage_field, render_deps_field, package_lists %}
|
||||||
return unsafe
|
|
||||||
.replace(/&/g, "&")
|
|
||||||
.replace(/</g, "<")
|
|
||||||
.replace(/>/g, ">")
|
|
||||||
.replace(/"/g, """)
|
|
||||||
.replace(/'/g, "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
all_packages = meta_packages.slice();
|
|
||||||
|
|
||||||
{% for p in packages %}
|
|
||||||
all_packages.push({
|
|
||||||
id: "{{ p.author.username }}/{{ p.name }}",
|
|
||||||
value: escape({{ p.title | tojson }} + " by " + {{ p.author.display_name | tojson }}),
|
|
||||||
toString: function() { return escape({{ p.title | tojson }} + " by " + {{ p.author.display_name | tojson }} + " only"); },
|
|
||||||
});
|
|
||||||
{% endfor %}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% from "macros/forms.html" import render_field, render_submit_field, form_includes, render_multiselect_field, render_mpackage_field, render_deps_field %}
|
|
||||||
{{ form_includes() }}
|
{{ form_includes() }}
|
||||||
|
{{ package_lists() }}
|
||||||
|
|
||||||
<form method="POST" action="" class="tableform">
|
<form method="POST" action="" class="tableform">
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
|
@ -5,19 +5,30 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from "macros/forms.html" import render_field, render_submit_field, form_includes, render_multiselect_field %}
|
{% from "macros/forms.html" import render_field, render_submit_field, form_includes, render_multiselect_field, render_mpackage_field, render_deps_field, package_lists %}
|
||||||
{{ form_includes() }}
|
{{ form_includes() }}
|
||||||
|
{{ package_lists() }}
|
||||||
|
|
||||||
<form method="POST" action="">
|
<form method="POST" action="">
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
|
|
||||||
|
<h2 class="pkg_meta">Package</h2>
|
||||||
|
|
||||||
|
{{ render_field(form.type) }}
|
||||||
{{ render_field(form.name) }}
|
{{ render_field(form.name) }}
|
||||||
{{ render_field(form.title) }}
|
{{ render_field(form.title) }}
|
||||||
{{ render_field(form.shortDesc) }}
|
{{ render_field(form.shortDesc) }}
|
||||||
{{ render_field(form.desc) }}
|
{{ render_field(form.desc) }}
|
||||||
{{ render_field(form.type) }}
|
|
||||||
{{ render_field(form.license) }}
|
|
||||||
{{ render_multiselect_field(form.tags) }}
|
{{ render_multiselect_field(form.tags) }}
|
||||||
|
|
||||||
|
<h2 class="not_txp">Dependency Info</h2>
|
||||||
|
|
||||||
|
{{ render_mpackage_field(form.provides_str, class_="not_txp", placeholder="Comma separated list") }}
|
||||||
|
{{ 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") }}
|
||||||
|
|
||||||
|
{{ render_field(form.license) }}
|
||||||
|
{{ render_field(form.media_license) }}
|
||||||
{{ render_field(form.repo) }}
|
{{ render_field(form.repo) }}
|
||||||
{{ render_field(form.website) }}
|
{{ render_field(form.website) }}
|
||||||
{{ render_field(form.issueTracker) }}
|
{{ render_field(form.issueTracker) }}
|
||||||
@ -29,4 +40,6 @@
|
|||||||
{{ render_field(form.edit_desc) }}
|
{{ render_field(form.edit_desc) }}
|
||||||
{{ render_submit_field(form.submit) }}
|
{{ render_submit_field(form.submit) }}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script src="/static/package_edit.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -117,9 +117,9 @@
|
|||||||
<li><a href="{{ package.getEditURL() }}">Edit</a></li>
|
<li><a href="{{ package.getEditURL() }}">Edit</a></li>
|
||||||
<li><a href="{{ package.getNewScreenshotURL() }}">Add screenshot</a></li>
|
<li><a href="{{ package.getNewScreenshotURL() }}">Add screenshot</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.is_authenticated %}
|
{# {% if current_user.is_authenticated %}
|
||||||
<li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Changes</a></li>
|
<li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Changes</a></li>
|
||||||
{% endif %}
|
{% endif %} #}
|
||||||
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
|
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
|
||||||
<li><a href="{{ package.getCreateReleaseURL() }}">Create Release</a></li>
|
<li><a href="{{ package.getCreateReleaseURL() }}">Create Release</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -216,6 +216,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table> -->
|
</table> -->
|
||||||
|
|
||||||
|
{#
|
||||||
{% if current_user.is_authenticated or requests %}
|
{% if current_user.is_authenticated or requests %}
|
||||||
<h3>Edit Requests</h3>
|
<h3>Edit Requests</h3>
|
||||||
|
|
||||||
@ -231,4 +232,5 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
#}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -68,7 +68,7 @@ def _do_login_user(user, remember_me=False):
|
|||||||
|
|
||||||
user.active = True
|
user.active = True
|
||||||
if not user.rank.atLeast(UserRank.NEW_MEMBER):
|
if not user.rank.atLeast(UserRank.NEW_MEMBER):
|
||||||
user.rank = UserRank.NEW_MEMBER
|
user.rank = UserRank.MEMBER
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -272,4 +272,4 @@ def delete_package_page(package):
|
|||||||
|
|
||||||
return redirect(url)
|
return redirect(url)
|
||||||
|
|
||||||
from . import todo, screenshots, editrequests, releases
|
from . import todo, screenshots, releases
|
||||||
|
@ -58,8 +58,13 @@ def create_edit_editrequest_page(package, id=None):
|
|||||||
edited_package = Package(package)
|
edited_package = Package(package)
|
||||||
erequest.applyAll(edited_package)
|
erequest.applyAll(edited_package)
|
||||||
|
|
||||||
|
|
||||||
form = EditRequestForm(request.form, obj=edited_package)
|
form = EditRequestForm(request.form, obj=edited_package)
|
||||||
|
if request.method == "GET":
|
||||||
|
deps = edited_package.dependencies
|
||||||
|
form.harddep_str.data = ",".join([str(x) for x in deps if not x.optional])
|
||||||
|
form.softdep_str.data = ",".join([str(x) for x in deps if x.optional])
|
||||||
|
form.provides_str.data = MetaPackage.ListToSpec(edited_package.provides)
|
||||||
|
|
||||||
if request.method == "POST" and form.validate():
|
if request.method == "POST" and form.validate():
|
||||||
if erequest is None:
|
if erequest is None:
|
||||||
erequest = EditRequest()
|
erequest = EditRequest()
|
||||||
|
Loading…
Reference in New Issue
Block a user