Fixes #1 automatic upload issue

This commit is contained in:
Chris Smith
2025-02-23 18:16:53 +01:00
parent 741078206b
commit 1408f84924
2 changed files with 10 additions and 7 deletions

View File

@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixes
* Automatic upload checkbox on upload form #1
### Added ### Added
* "Today So Far" summary on the success page * "Today So Far" summary on the success page

View File

@@ -43,7 +43,7 @@ $this->registerJS(
emojiIndex = (emojiIndex + 1) % foodEmojis.length; // Cycle through emojis emojiIndex = (emojiIndex + 1) % foodEmojis.length; // Cycle through emojis
}, 1100); // Adjust the interval (in milliseconds) for the desired speed }, 1100); // Adjust the interval (in milliseconds) for the desired speed
$('#mealform-picture').on('change', function(ev) { $('#file-input').on('change', function(ev) {
if (localStorage.getItem('autoUpload') === 'true') { // Check localStorage if (localStorage.getItem('autoUpload') === 'true') { // Check localStorage
$('#submitButton').text('Processing...'); $('#submitButton').text('Processing...');
$('#submitButton').attr('disabled', true); $('#submitButton').attr('disabled', true);
@@ -100,11 +100,11 @@ $this->registerCssFile('@web/css/upload.css');
->field($model, 'type') ->field($model, 'type')
->radioList($model->getTypeList(), [ ->radioList($model->getTypeList(), [
'class' => 'btn-group d-flex justify-content-center', 'class' => 'btn-group d-flex justify-content-center',
'item' => function ($index, $label, $name, $checked, $value) { 'item' => function ($index, $label, $name, $checked, $value) {
$return = '<input class="btn-check" type="radio" value="'.$value.'" id="'.$value.'" name="' . $name . '" autocomplete="off" ' . ($checked ? "checked" : "") . '>'; $return = '<input class="btn-check" type="radio" value="'.$value.'" id="'.$value.'" name="' . $name . '" autocomplete="off" ' . ($checked ? "checked" : "") . '>';
$return .= '<label class="btn btn-outline-primary" for="'.$value.'">' . $label . '</label>'; $return .= '<label class="btn btn-outline-primary" for="'.$value.'">' . $label . '</label>';
return $return; return $return;
}, },
]) ])
->label(false); ?> ->label(false); ?>
</div> </div>
@@ -115,7 +115,6 @@ $this->registerCssFile('@web/css/upload.css');
</div> </div>
<div class="d-grid gap-2 d-md-block"> <div class="d-grid gap-2 d-md-block">
<?= Html::submitButton('Save meal!', ['id' => 'submitButton', 'class' => 'btn btn-success']) ?> <?= Html::submitButton('Save meal!', ['id' => 'submitButton', 'class' => 'btn btn-success']) ?>
</div> </div>
<?php <?php