aTweet/templates/g.html

80 lines
3.8 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Groups - aTweet</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<div class="container">
<h1>Groups</h1>
<button class="btn btn-primary" onclick="toggleNewGroupForm()">Create a new Group</button>
<div id="new-group-form" class="hidden overlay">
<div class="overlay-content">
<h2>Create a new Group</h2>
<form action="{{ url_for('new_group') }}" method="POST" enctype="multipart/form-data" onsubmit="return confirmGroupCreation()">
<input type="text" name="group_name" placeholder="Enter group name" required>
<input type="text" name="vanity_url" placeholder="Vanity URL (e.g., tech)" required>
<textarea name="description" placeholder="Group description"></textarea>
<input type="file" name="group_picture" accept="image/*">
<button type="submit" class="btn btn-success">Create Group</button>
<form action="{{ url_for('groups') }}" method="GET" class="search-form">
<input type="text" name="search" placeholder="Search groups" value="{{ search_query }}">
<button type="submit" class="btn btn-primary">Search</button>
</form>
</form>
<button class="btn btn-secondary" onclick="toggleNewGroupForm()">Cancel</button>
</div>
</div>
<div class="group-list">
{% for group in groups %}
<a href="{{ url_for('group_detail', vanity_url=group.vanity_url) }}" class="group-item">
<img src="{{ url_for('static', filename='uploads/' + (group.avatar if group.avatar else 'default_pfp.png')) }}" alt="{{ group.name }}" class="group-avatar">
<div class="group-info">
<span class="group-name">{{ group.name | safe }}</span>
<span class="group-description">{{ group.description | safe }}</span>
</div>
</a>
{% endfor %}
</div>
</div>
<footer>
<div class="footer-container">
<a href="{{ url_for('index') }}" class="footer-button">
<i class="fas fa-home"></i> Home
</a>
<a href="{{ url_for('profile', username=session.username) }}" class="footer-button">
<i class="fas fa-user"></i> Profile
</a>
<a href="{{ url_for('groups') }}" class="footer-button">
<i class="fas fa-users"></i> Groups
</a>
<a href="{{ url_for('dms') }}" class="footer-button">
<i class="fas fa-envelope"></i> DMs
</a>
{% if session.user_id and get_user_by_id(session.user_id)['username'] == 'avery' %}
<a href="{{ url_for('admin_panel') }}" class="footer-button">
<i class="fas fa-cog"></i> Admin Panel
</a>
{% endif %}
<a href="{{ url_for('logout') }}" class="footer-button">
<i class="fas fa-sign-out-alt"></i> Logout
</a>
</div>
</footer>
<script>
function toggleNewGroupForm() {
const form = document.getElementById('new-group-form');
form.classList.toggle('hidden');
}
function confirmGroupCreation() {
return confirm('Are you sure you want to create this group?');
}
</script>
</body>
</html>