Add form fields to file manager form

This commit is contained in:
Alice Gaudon 2020-06-14 15:05:04 +02:00
parent 3e1a9a8ca6
commit f4571ab153
4 changed files with 37 additions and 5 deletions

View File

@ -1,6 +1,7 @@
{
"bundles": {
"app": "js/app.js",
"fm": "js/fm.js",
"layout": "sass/layout.scss",
"error": "sass/error.scss",
"logo": "img/logo.svg",

9
assets/js/fm.js Normal file
View File

@ -0,0 +1,9 @@
document.addEventListener('DOMContentLoaded', () => {
const neverExpireCheckbox = document.getElementById('field-never_expire');
const expireAfterDaysField = document.getElementById('field-expire_after_days');
neverExpireCheckbox.addEventListener('change', () => {
// noinspection RedundantConditionalExpressionJS
expireAfterDaysField.disabled = neverExpireCheckbox.value ? true : false;
});
});

View File

@ -2,6 +2,10 @@
{% set title = 'ily.li - File manager' %}
{% block scripts %}
<script src="/js/fm.js"></script>
{% endblock %}
{% block body %}
<h1>File manager</h1>
<p>You're their manager, please be nice with them.</p>
@ -12,12 +16,27 @@
<form action="{{ route('post-file') }}" method="POST">
{{ macros.field(_locals, 'file', 'upload', '', 'Choose wisely', 'The maximum upload size is' + max_upload_size, validation_attributes='required') }}
{{ macros.field(_locals, 'number', 'expire_after_days', '30', 'How many days to delete this file after', null, validation_attributes='max="1825"') }}
{{ macros.field(_locals, 'checkbox', 'never_expire', '', 'Never delete this file') }}
<button type="submit">Upload <i data-feather="upload"></i></button>
</form>
</section>
<section class="panel">
<h2>File list</h2>
</section>
</div>
<section class="panel">
<h2>File list</h2>
<table>
<thead>
<tr>
<th>#</th>
<th>url</th>
<th>name</th>
<th>Expires at</th>
</tr>
</thead>
</table>
</section>
{% endblock %}

View File

@ -16,6 +16,9 @@
<nav>
<ul>
<li><a href="{{ route('about') }}"><i data-feather="info"></i> About</a></li>
{% if user %}
<li><a href="{{ route('file-manager') }}"><i data-feather="folder"></i>File manager</a></li>
{% endif %}
</ul>
</nav>
{% endblock %}