Styled file upload buttons for audio and images
Build and Deploy / build-and-deploy (push) Successful in 40s

This commit is contained in:
2026-07-08 09:43:21 -04:00
parent b32c0a1ba6
commit a047338210
3 changed files with 33 additions and 10 deletions
+19 -6
View File
@@ -14,7 +14,9 @@
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: bold; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; }
.current-file { font-size: 0.85rem; color: #666; margin-top: 0.25rem; }
</style>
.file-upload { position: relative; display: inline-block; }
.file-upload input[type="file"] { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-name { margin-left: 0.5rem; font-size: 0.85rem; color: #666; }
</head>
<body>
<nav class="nb-navbar" role="navigation" aria-label="Main navigation">
@@ -41,20 +43,25 @@
<div class="nb-form-group">
<label for="description">Description</label>
<textarea id="description" name="description" class="nb-textarea"
rows="4">{{if .Editing}}{{.Episode.Description}}{{end}}</textarea>
</div>
<div class="nb-form-group">
<label for="audio_file">Audio File</label>
<input type="file" id="audio_file" name="audio_file" accept="audio/*" />
<div class="file-upload">
<input type="file" id="audio_file" name="audio_file" accept="audio/*" onchange="updateFileName(this)" />
<label for="audio_file" class="nb-button blue file-label">Choose Audio File</label>
<span class="file-name" id="audio_file_name"></span>
</div>
{{if .Editing}}
<div class="current-file">
{{if .Episode.AudioPath}}Current: {{.Episode.AudioPath}}{{else}}No audio file uploaded.{{end}}
</div>
{{end}}
</div>
<div class="nb-form-group">
<label for="image_file">Episode Image (optional)</label>
<input type="file" id="image_file" name="image_file" accept="image/*" />
<div class="file-upload">
<input type="file" id="image_file" name="image_file" accept="image/*" onchange="updateFileName(this)" />
<label for="image_file" class="nb-button blue file-label">Choose Image</label>
<span class="file-name" id="image_file_name"></span>
</div>
{{if .Editing}}
<div class="current-file">
{{if .Episode.ImagePath}}Current: {{.Episode.ImagePath}}{{else}}No image uploaded.{{end}}
@@ -73,6 +80,12 @@
</form>
</div>
<script>
function updateFileName(input) {
const span = document.getElementById(input.id + '_name');
if (span && input.files.length > 0) {
span.textContent = input.files[0].name;
}
}
(function() {
const input = document.getElementById('published_at');
if (!input.value) {