MarseyWorld/files/templates/submit_hats.html

97 lines
5.5 KiB
HTML

{% extends "submit_navbar.html" %}
{% block pagetitle %}Submit Hats{% endblock %}
{% block pagetype %}message{% endblock %}
{% block content %}
<h2 class="mt-3 mt-md-5">Submit Hat</h2>
<div class="settings-section rounded">
<div class="d-lg-flex">
<div class="body w-lg-100">
<form action="/submit/hats" method="post" enctype="multipart/form-data" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRReload(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<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>Select Image</div>
<input autocomplete="off" id="file-upload" accept="image/*" type="file" name="image" {% if g.is_tor %}disabled{% endif %} hidden>
</label>
</div>
<div id="hat-design-reference-block" class="mt-3">
<a href="{{SITE_FULL_IMAGES}}/i/hat-template.png" class="font-weight-bold">Hat Template</a> &mdash; 100x130px (do not resize), circle is profile picture, do not include circle in final submission.
</div>
<label class="mt-3" for="name">Hat Name</label>
<input autocomplete="off" type="text" id="name" class="form-control" name="name" maxlength="50" 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_\-]{1,30}' placeholder="Required" value="{{username}}" required>
<label class="mt-3" for="description">Description</label>
<input autocomplete="off" type="text" id="description" class="form-control" name="description" maxlength="300" pattern='[^<>&\n\t]{1,300}' placeholder="Required" value="{{description}}" required>
<div class="footer mt-5">
<div class="d-flex">
<input id="submit-btn" disabled type="submit" class="btn btn-primary ml-auto" value="Submit Hat">
</div>
</div>
</form>
</div>
</div>
</div>
<h2 class="mt-5 mx-1">Pending Approval</h2>
<div class="mt-5">
<div class="col px-0">
<div class="settings">
{% for hat in hats %}
<div id="{{hat.name}}-hat" class="settings-section rounded">
<div class="d-lg-flex">
<div class="body w-lg-100">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<div><label class="mt-3">Image</label></div>
<img loading="lazy" src="{{SITE_FULL_IMAGES}}/asset_submissions/hats/{{hat.name}}.webp?s={{range(1, 10000000)|random}}" style="max-width:50%;border:5px white solid">
<div class="profile-pic-100-wrapper ml-4 mt-4">
<img loading="lazy" alt="avatar" src="{{v.profile_url}}" class="profile-pic-100">
<img loading="lazy" class="profile-pic-100-hat" src="{{SITE_FULL_IMAGES}}/asset_submissions/hats/{{hat.name}}.webp?s={{range(1, 10000000)|random}}">
</div>
<div><label class="mt-3" for="{{hat.name}}-submitter">Submitter</label></div>
<input autocomplete="off" type="text" id="{{hat.name}}-submitter" class="form-control" maxlength="30" value="{{hat.submitter.username}}" readonly>
<label class="mt-3" for="{{hat.name}}-author">Author</label>
<input autocomplete="off" type="text" id="{{hat.name}}-author" class="form-control" maxlength="30" value="{{hat.author.username}}" readonly>
<label class="mt-3" for="{{hat.name}}-name">Hat Name</label>
<input autocomplete="off" type="text" id="{{hat.name}}-name" class="form-control" name="name" maxlength="30" value="{{hat.name}}" pattern='hat[a-zA-Z0-9]{1,24}' placeholder="Required" required {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %}>
<label class="mt-3" for="{{hat.name}}-description">Description</label>
<input autocomplete="off" type="text" id="{{hat.name}}-description" class="form-control" name="description" maxlength="300" value="{{hat.description}}" pattern='[^<>&\n\t]{1,300}' placeholder="Required" required {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %}>
<div><label class="mt-3" for="{{hat.name}}-price">Price</label></div>
<input autocomplete="off" type="number" id="{{hat.name}}-price" class="form-control" name="price" min="0" value="{{hat.price}}" 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 == hat.submitter_id %}
<div class="d-flex my-4 mx-3">
<input autocomplete="off" type="text" id="{{hat.name}}-comment" class="form-control mr-4" name="comment" placeholder="Comment..." maxlength="500" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}hidden{% endif %}>
<button type="button" class="btn btn-danger ml-auto" data-nonce="{{g.nonce}}" data-onclick="remove_hat(this)" data-name="{{hat.name}}">Remove</button>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}
<button type="button" class="btn btn-success ml-3 mr-1" data-nonce="{{g.nonce}}" data-onclick="approve_hat(this)" data-name="{{hat.name}}">Approve</button>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
</div>
<script defer src="{{'js/submit_hats.js' | asset}}"></script>
{% endblock %}