Enhance upload functionality: add channel selection, display duration, and fix media file visibility

This commit is contained in:
ske087
2025-08-19 13:08:09 +03:00
parent 4ea27fa76c
commit 0974b33785
2 changed files with 66 additions and 18 deletions

View File

@@ -74,18 +74,29 @@
</div>
<div class="card-body">
<form method="post" enctype="multipart/form-data" action="/upload" class="row g-3">
<div class="col-md-8">
<div class="input-group">
<input type="file" class="form-control" name="file" accept=".png,.jpg,.jpeg,.gif,.mp4,.avi,.mov,.pdf" required>
<button type="submit" class="btn btn-success">
<i class="bi bi-upload"></i> Upload
</button>
</div>
<div class="col-md-12">
<label for="file" class="form-label">Select Media File</label>
<input type="file" class="form-control" name="file" id="file" accept=".png,.jpg,.jpeg,.gif,.mp4,.avi,.mov,.pdf" required>
<small class="text-muted">Supported: Images, Videos, PDFs</small>
</div>
<div class="col-md-4">
<small class="text-muted">
Supported: Images, Videos, PDFs
</small>
<div class="col-md-6">
<label for="channel_id" class="form-label">Add to Channel (Optional)</label>
<select class="form-select" name="channel_id" id="channel_id">
<option value="">Select Channel...</option>
{% for channel in channels %}
<option value="{{ channel.id }}">{{ channel.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label for="display_duration" class="form-label">Display Duration (seconds)</label>
<input type="number" class="form-control" name="display_duration" id="display_duration" min="1" max="300" value="10" placeholder="10">
<small class="text-muted">How long to display this media (1-300 seconds)</small>
</div>
<div class="col-12">
<button type="submit" class="btn btn-success">
<i class="bi bi-upload"></i> Upload Media
</button>
</div>
</form>
</div>
@@ -99,12 +110,12 @@
<div class="card">
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
<h5 class="mb-0"><i class="bi bi-file-earmark-image"></i> All Media Files</h5>
<span class="badge bg-light text-dark">{{ files|length }} files</span>
<span class="badge bg-light text-dark">{{ user_files|length }} files</span>
</div>
<div class="card-body">
{% if files %}
{% if user_files %}
<div class="media-grid">
{% for file in files %}
{% for file in user_files %}
<div class="card media-card">
<div class="file-preview">
{% if file.file_type in ['jpg', 'jpeg', 'png', 'gif'] %}