1
0
forked from shaytan/rdgen

add save/load configuration

This commit is contained in:
Bryan Gerlach
2025-02-05 00:32:59 -06:00
parent f294a1feda
commit 87f587699c
3 changed files with 11 additions and 7 deletions

View File

@@ -33,6 +33,8 @@ class GenerateForm(forms.Form):
#Visual
iconfile = forms.FileField(label="Custom App Icon (in .png format)", required=False, widget=forms.FileInput(attrs={'accept': 'image/png'}))
logofile = forms.FileField(label="Custom App Logo (in .png format)", required=False, widget=forms.FileInput(attrs={'accept': 'image/png'}))
iconbase64 = forms.CharField(required=False)
logobase64 = forms.CharField(required=False)
theme = forms.ChoiceField(choices=[
('light', 'Light'),
('dark', 'Dark'),

View File

@@ -205,6 +205,8 @@
<div class="section">
<h2><i class="fas fa-paint-brush"></i> Visual</h2>
{{ form.iconbase64.as_hidden }}
{{ form.logobase64.as_hidden }}
<label for="{{ form.iconfile.id_for_label }}">Custom App Icon (in .png format)</label>
{{ form.iconfile }}<br><br>
<!-- <input type="file" name="iconfile" id="iconfile" accept="image/png"> -->
@@ -407,9 +409,11 @@
// Handle image previews (as before)
if (key === 'iconfile' && formData[key]) {
document.getElementById('id_iconbase64').value = formData[key]
document.getElementById('icon-preview').innerHTML = `<img src="${formData[key]}" style="max-width: 300px; max-height: 60px;">`;
}
if (key === 'logofile' && formData[key]) {
document.getElementById('id_logobase64').value = formData[key]
document.getElementById('logo-preview').innerHTML = `<img src="${formData[key]}" style="max-width: 300px; max-height: 60px;">`;
}
}

File diff suppressed because one or more lines are too long