updated the upload page
This commit is contained in:
11
app.py
11
app.py
@@ -114,6 +114,8 @@ def logout():
|
||||
@app.route('/upload_content', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def upload_content():
|
||||
players = Player.query.all()
|
||||
groups = Group.query.all()
|
||||
if request.method == 'POST':
|
||||
target_type = request.form['target_type']
|
||||
target_id = request.form['target_id']
|
||||
@@ -129,7 +131,7 @@ def upload_content():
|
||||
|
||||
db.session.commit()
|
||||
return redirect(url_for('dashboard'))
|
||||
return render_template('upload_content.html')
|
||||
return render_template('upload_content.html', players=players, groups=groups)
|
||||
|
||||
@app.route('/admin')
|
||||
@login_required
|
||||
@@ -292,6 +294,13 @@ def player_fullscreen(player_id):
|
||||
content = Content.query.filter_by(player_id=player_id).all()
|
||||
return render_template('player_fullscreen.html', player=player, content=content)
|
||||
|
||||
@app.route('/group/<int:group_id>/fullscreen')
|
||||
@login_required
|
||||
def group_fullscreen(group_id):
|
||||
group = Group.query.get_or_404(group_id)
|
||||
content = Content.query.filter_by(group_id=group.id).all()
|
||||
return render_template('group_fullscreen.html', group=group, content=content)
|
||||
|
||||
@app.route('/player/<int:player_id>/delete', methods=['POST'])
|
||||
@login_required
|
||||
@admin_required
|
||||
|
||||
Binary file not shown.
@@ -80,6 +80,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<a href="{{ url_for('manage_group', group_id=group.id) }}" class="btn btn-sm btn-secondary">Manage Group</a>
|
||||
<a href="{{ url_for('group_fullscreen', group_id=group.id) }}" class="btn btn-sm btn-primary">Full Screen</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
49
templates/group_fullscreen.html
Normal file
49
templates/group_fullscreen.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Group Fullscreen Schedule</title>
|
||||
<style>
|
||||
body, html {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: black;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
display: none;
|
||||
}
|
||||
img.active {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
{% for item in content %}
|
||||
<img src="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" alt="Content Image" data-duration="{{ item.duration }}">
|
||||
{% endfor %}
|
||||
</div>
|
||||
<script>
|
||||
const images = document.querySelectorAll('#content img');
|
||||
let index = 0;
|
||||
|
||||
function showNextImage() {
|
||||
images.forEach((img, i) => {
|
||||
img.classList.toggle('active', i === index);
|
||||
});
|
||||
const duration = images[index].getAttribute('data-duration') * 1000;
|
||||
index = (index + 1) % images.length;
|
||||
setTimeout(showNextImage, duration);
|
||||
}
|
||||
|
||||
if (images.length > 0) {
|
||||
images[0].classList.add('active');
|
||||
showNextImage();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -91,6 +91,7 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a href="{{ url_for('group_fullscreen', group_id=group.id) }}" class="btn btn-primary mt-3">Full Screen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,36 +2,46 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Upload Content</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Upload Content</h1>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<label>Target Type:</label>
|
||||
<select name="target_type" required>
|
||||
<option value="player">Player</option>
|
||||
<option value="group">Group</option>
|
||||
</select><br>
|
||||
|
||||
<label>Target ID:</label>
|
||||
<select name="target_id" required>
|
||||
<optgroup label="Players">
|
||||
{% for player in players %}
|
||||
<option value="{{ player.id }}">{{ player.username }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
<optgroup label="Groups">
|
||||
{% for group in groups %}
|
||||
<option value="{{ group.id }}">{{ group.name }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select><br>
|
||||
|
||||
<label>Files:</label>
|
||||
<input type="file" name="files" multiple required><br>
|
||||
<label>Duration (seconds):</label>
|
||||
<input type="number" name="duration" required><br>
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
<a href="{{ url_for('dashboard') }}">Back to Dashboard</a>
|
||||
<div class="container py-5">
|
||||
<h1 class="text-center mb-4">Upload Content</h1>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="mb-3">
|
||||
<label for="target_type" class="form-label">Target Type:</label>
|
||||
<select name="target_type" id="target_type" class="form-select" required>
|
||||
<option value="player">Player</option>
|
||||
<option value="group">Group</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="target_id" class="form-label">Target ID:</label>
|
||||
<select name="target_id" id="target_id" class="form-select" required>
|
||||
<optgroup label="Players">
|
||||
{% for player in players %}
|
||||
<option value="{{ player.id }}">{{ player.username }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
<optgroup label="Groups">
|
||||
{% for group in groups %}
|
||||
<option value="{{ group.id }}">{{ group.name }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="files" class="form-label">Files:</label>
|
||||
<input type="file" name="files" id="files" class="form-control" multiple required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="duration" class="form-label">Duration (seconds):</label>
|
||||
<input type="number" name="duration" id="duration" class="form-control" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Upload</button>
|
||||
</form>
|
||||
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary mt-3">Back to Dashboard</a>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user