MarseyWorld/files/templates/submit_marseys.html

89 lines
4.6 KiB
HTML

{% extends "default.html" %}
{% block pagetitle %}Submit Marseys{% endblock %}
{% block pagetype %}message{% endblock %}
{% block content %}
{% if error %}{{macros.alert(error, true)}}{% endif %}
{% if msg %}{{macros.alert(msg, false)}}{% endif %}
<div class="mx-4">
<h2 class="mt-5">Submit Marsey</h2>
<div class="settings-section rounded">
<div class="d-lg-flex">
<div class="body w-lg-100">
<form action="/submit/marseys" method="post" enctype="multipart/form-data">
<input hidden name="formkey" value="{{v|formkey}}">
<div id="image-upload-block">
<div><label class="mt-3">Image</label></div>
<img loading="lazy" id="image-preview" class="d-none" style="max-width:50%;border:5px white solid">
<label class="btn btn-secondary m-0" for="file-upload">
<div id="filename-show">Select Image</div>
<input autocomplete="off" id="file-upload" accept="image/*" type="file" name="image" {% if g.is_tor %}disabled{% endif %} hidden>
</label>
</div>
<label class="mt-3" for="name">Name</label>
<input autocomplete="off" type="text" id="name" class="form-control" name="name" maxlength="30" pattern='[Mm][Aa][Rr][Ss][Ee][Yy][a-zA-Z0-9]{1,24}' placeholder="Required" value="{{name}}" required>
<label class="mt-3" for="author">Author</label>
<input autocomplete="off" type="text" id="author" class="form-control" name="author" maxlength="30" pattern='[a-zA-Z0-9_\-]{3,30}' placeholder="Required" value="{{username}}" required>
<label class="mt-3" for="tags">Tags (must be separated by spaces)</label>
<input autocomplete="off" type="text" id="tags" class="form-control" name="tags" maxlength="200" pattern='[a-zA-Z0-9: ]{1,200}' placeholder="Required" value="{{tags}}" required>
<div class="footer mt-5">
<div class="d-flex">
<input id="submit-marsey" disabled type="submit" data-nonce="{{g.nonce}}" data-onclick="disable(this)" class="btn btn-primary ml-auto" value="Submit Marsey">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<input hidden id="IMAGE_FORMATS" value="{{IMAGE_FORMATS}}">
<script defer src="{{'js/submit_marseys.js' | asset}}"></script>
<h2 class="mt-5 mx-4">Pending Approval</h2>
<div class="row mt-5 mx-4">
<div class="col px-0">
<div class="settings">
{% for marsey in marseys %}
<div id="{{marsey.name}}-marsey" class="settings-section rounded">
<div class="d-lg-flex">
<div class="body w-lg-100">
<input hidden name="formkey" value="{{v|formkey}}">
<div><label class="mt-3">Image</label></div>
<img loading="lazy" src="/asset_submissions/marseys/{{marsey.name}}.webp?s={{range(1, 10000000)|random}}" style="max-width:50%;border:5px white solid">
<div><label class="mt-3" for="{{marsey.name}}-submitter">Submitter</label></div>
<input autocomplete="off" type="text" id="{{marsey.name}}-submitter" class="form-control" maxlength="30" value="{{marsey.submitter}}" readonly>
<label class="mt-3" for="{{marsey.name}}-author">Author</label>
<input autocomplete="off" type="text" id="{{marsey.name}}-author" class="form-control" maxlength="30" value="{{marsey.author}}" readonly>
<label class="mt-3" for="{{marsey.name}}-name">Name</label>
<input autocomplete="off" type="text" id="{{marsey.name}}-name" class="form-control" name="name" maxlength="30" value="{{marsey.name}}" pattern='marsey[a-z0-9]{1,24}' placeholder="Required" required {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %}>
<label class="mt-3" for="{{marsey.name}}-tags">Tags</label>
<input autocomplete="off" type="text" id="{{marsey.name}}-tags" class="form-control" name="tags" maxlength="200" value="{{marsey.tags}}" pattern='[a-z0-9: ]{1,200}' placeholder="Required" required {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %}>
</div>
</div>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] or v.id == marsey.submitter_id %}
<div class="d-flex my-4 mx-3">
<button type="button" class="btn btn-primary ml-auto" data-nonce="{{g.nonce}}" data-onclick="remove_marsey(this, '{{marsey.name}}')">Remove</button>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}
<button type="button" class="btn btn-primary ml-3" data-nonce="{{g.nonce}}" data-onclick="approve_marsey(this, '{{marsey.name}}')">Approve</button>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}