Skip to content

Commit fb2500a

Browse files
committed
fix: Fix bug regarding the manual file size input where it was not possible to increment the value of the file size in 'kb' on initial render if the radio input with the value 'kb' is not deselected and selected again and the current value is more than 100
- Removed the console log in the 'changePattern' function in 'git_form.jinja'
1 parent 718a799 commit fb2500a

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/server/templates/components/git_form.jinja

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
});
2525
2626
function changePattern(element) {
27-
console.log("Pattern changed", element.value);
2827
let patternType = element.value;
2928
const files = document.getElementsByName("tree-line");
3029
@@ -60,9 +59,11 @@
6059
if (element.checked) {
6160
sliderContainer.classList.add('hidden');
6261
manualSizeInput.classList.remove('hidden');
63-
64-
if (!manualSizeValueInput.value || manualSizeValueInput.value.trim() === '') {
65-
manualSizeValueInput.value = "1024";
62+
const sizeUnit = sizeUnitInput.value;
63+
const maxValue = sizeUnit === 'kb' ? 100 * 1024 : 100;
64+
manualSizeValueInput.max = maxValue;
65+
if (parseInt(manualSizeValueInput.value) > maxValue) {
66+
manualSizeValueInput.value = maxValue;
6667
}
6768
hiddenSizeInput.value = manualSizeValueInput.value || "1024";
6869
} else {
@@ -72,15 +73,11 @@
7273
const sliderValue = document.getElementById('file_size').value;
7374
hiddenSizeInput.value = sliderValue;
7475
}
75-
76-
console.log("Use manual input: " + hiddenInput.value);
77-
console.log("Manual size value: " + hiddenSizeInput.value);
7876
}
7977
8078
function updateManualSizeValue(element) {
8179
const hiddenSizeInput = document.getElementById('max_file_size_manual');
8280
hiddenSizeInput.value = element.value || "1024";
83-
console.log("Manual size updated to: " + hiddenSizeInput.value + "KB");
8481
}
8582
8683
function updateSizeUnit(element) {
@@ -90,24 +87,19 @@
9087
const sizeUnit = element.value;
9188
const currentValue = parseInt(manualSizeValueInput.value);
9289
93-
// Update the hidden size unit input
9490
hiddenSizeUnitInput.value = sizeUnit;
9591
96-
// Update the max attribute of the manual size input
9792
const maxValue = sizeUnit === 'kb' ? 100 * 1024 : 100;
9893
manualSizeValueInput.max = maxValue;
9994
100-
// If switching to MB and current value is over 100, set it to 100
10195
if (sizeUnit === 'mb' && currentValue > 100) {
10296
manualSizeValueInput.value = 100;
103-
// Also update the hidden input
10497
hiddenSizeInput.value = 100;
10598
}
10699
107100
console.log("Size unit changed to: " + sizeUnit.toUpperCase());
108101
}
109102
110-
// Add input validation to prevent values over max
111103
document.getElementById('max_file_size_manual_input').addEventListener('input', function() {
112104
const maxValue = parseInt(this.max);
113105
const currentValue = parseInt(this.value);

0 commit comments

Comments
 (0)