diff --git a/assets/config.json b/assets/config.json index 5c18915..a181d7c 100644 --- a/assets/config.json +++ b/assets/config.json @@ -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", diff --git a/assets/js/fm.js b/assets/js/fm.js new file mode 100644 index 0000000..65f6307 --- /dev/null +++ b/assets/js/fm.js @@ -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; + }); +}); \ No newline at end of file diff --git a/views/file-manager.njk b/views/file-manager.njk index df4b371..ab930b0 100644 --- a/views/file-manager.njk +++ b/views/file-manager.njk @@ -2,6 +2,10 @@ {% set title = 'ily.li - File manager' %} +{% block scripts %} + +{% endblock %} + {% block body %}

File manager

You're their manager, please be nice with them.

@@ -12,12 +16,27 @@
{{ 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') }} + +
- -
-

File list

- -
+ +
+

File list

+ + + + + + + + + +
#urlnameExpires at
+
{% endblock %} \ No newline at end of file diff --git a/views/layouts/base.njk b/views/layouts/base.njk index 36e5e8d..2a747de 100644 --- a/views/layouts/base.njk +++ b/views/layouts/base.njk @@ -16,6 +16,9 @@ {% endblock %}