diff options
| author | 2025-08-08 17:39:38 +0200 | |
|---|---|---|
| committer | 2025-08-08 17:39:38 +0200 | |
| commit | d9197d7e32a97f29829ffd4cf4371b1853e51fa2 (patch) | |
| tree | 83549245e159f9cbdad05868a359afcf278bec79 /app/views/configure/archiving.phtml | |
| parent | a3854c2f5978ab40c023c8bdf9b4be96eca3ef22 (diff) | |
New JS attribute: `data-auto-leave-validation` (#7785)
Instead of a repeating pattern like: `<input type="text" value="something" data-leave-validation="something">`, you can now put a `data-auto-leave-validation="1"` attribute on a `<form>` for example, and it will automatically set the `data-leave-validation` attributes inside the form elements.
`data_auto_leave_validation(parent)` from `extra.js` is called on slider open and page load.
---------
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Diffstat (limited to 'app/views/configure/archiving.phtml')
| -rw-r--r-- | app/views/configure/archiving.phtml | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 10f8774cd..2b4152a7e 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -7,13 +7,13 @@ <h1><?= _t('conf.archiving') ?></h1> <p class="help"><?= _i('help') ?> <?= _t('conf.archiving.help') ?></p> - <form method="post" action="<?= _url('configure', 'archiving') ?>"> + <form method="post" action="<?= _url('configure', 'archiving') ?>" data-auto-leave-validation="1"> <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" /> <div class="form-group"> <label class="group-name" for="ttl_default"><?= _t('conf.archiving.ttl') ?></label> <div class="group-controls"> - <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?= FreshRSS_Context::userConf()->ttl_default ?>"><?php + <select class="number" name="ttl_default" id="ttl_default" required="required"><?php $found = false; foreach ([1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', @@ -42,11 +42,10 @@ <div class="group-controls"> <label class="checkbox" for="enable_keep_max"> <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= - empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? '' : ' checked="checked"' ?> - data-leave-validation="<?= empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? 0 : 1 ?>"/> + empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? '' : ' checked="checked"' ?> /> <?= _t('conf.archiving.keep_max') ?> <?php $keepMax = empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? 200 : FreshRSS_Context::userConf()->archiving['keep_max']; ?> - <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" data-leave-validation="<?= $keepMax ?>"/> + <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" /> </label> </div> </div> @@ -55,12 +54,10 @@ <div class="group-controls"> <label class="checkbox" for="enable_keep_period"> <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= - empty(FreshRSS_Context::userConf()->volatile['enable_keep_period']) ? '' : ' checked="checked"' ?> - data-leave-validation="<?= empty(FreshRSS_Context::userConf()->volatile['enable_keep_period']) ? 0 : 1 ?>"/> + empty(FreshRSS_Context::userConf()->volatile['enable_keep_period']) ? '' : ' checked="checked"' ?> /> <?= _t('conf.archiving.keep_period') ?> - <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::userConf()->volatile['keep_period_count'] ?>" - data-leave-validation="<?= FreshRSS_Context::userConf()->volatile['keep_period_count'] ?>"/> - <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::userConf()->volatile['keep_period_unit'] ?>"> + <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::userConf()->volatile['keep_period_count'] ?>" /> + <select class="number" name="keep_period_unit" id="keep_period_unit"> <option></option> <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option> <option value="P1M" <?= 'P1M' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option> @@ -77,8 +74,7 @@ <div class="group-controls"> <label class="checkbox" for="keep_favourites"> <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= - FreshRSS_Context::userConf()->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_favourites'] !== false ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> "/> <?= _t('conf.archiving.keep_favourites') ?> </label> </div> @@ -88,8 +84,7 @@ <div class="group-controls"> <label class="checkbox" for="keep_labels"> <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= - FreshRSS_Context::userConf()->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_labels'] !== false ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> /> <?= _t('conf.archiving.keep_labels') ?> </label> </div> @@ -99,8 +94,7 @@ <div class="group-controls"> <label class="checkbox" for="keep_unreads"> <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= - FreshRSS_Context::userConf()->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_unreads'] ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> /> <?= _t('conf.archiving.keep_unreads') ?> </label> </div> @@ -110,8 +104,7 @@ <div class="group-controls"> <label for="keep_min_default"><?= _t('conf.archiving.keep_min_by_feed') ?> <input type="number" id="keep_min_default" name="keep_min_default" min="0" value="<?= - FreshRSS_Context::userConf()->archiving['keep_min'] ?>" - data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_min'] ?>"> + FreshRSS_Context::userConf()->archiving['keep_min'] ?>" /> </label> </div> </div> |
