Create index.html
Browse files- index.html +115 -0
index.html
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base.html" %}
|
| 2 |
+
|
| 3 |
+
{% block title %}Home - Galeri Angkatan{% endblock %}
|
| 4 |
+
|
| 5 |
+
{% block content %}
|
| 6 |
+
<div class="row">
|
| 7 |
+
<div class="col-12">
|
| 8 |
+
<h1 class="text-center mb-4">Galeri Foto Angkatan</h1>
|
| 9 |
+
</div>
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
+
<!-- Trending Section -->
|
| 13 |
+
{% if trending %}
|
| 14 |
+
<div class="row mb-5">
|
| 15 |
+
<div class="col-12">
|
| 16 |
+
<h2 class="mb-3">
|
| 17 |
+
<i class="bi bi-fire text-danger"></i> Trending Photos
|
| 18 |
+
</h2>
|
| 19 |
+
</div>
|
| 20 |
+
{% for photo in trending %}
|
| 21 |
+
<div class="col-md-4 mb-4">
|
| 22 |
+
<div class="card trending-card h-100">
|
| 23 |
+
<div class="position-relative">
|
| 24 |
+
<img src="{{ url_for('static', filename='uploads/' + photo.filename) }}"
|
| 25 |
+
class="card-img-top" alt="{{ photo.caption }}">
|
| 26 |
+
<div class="trending-badge">
|
| 27 |
+
<i class="bi bi-fire"></i> #{{ loop.index }}
|
| 28 |
+
</div>
|
| 29 |
+
</div>
|
| 30 |
+
<div class="card-body">
|
| 31 |
+
<p class="card-text">{{ photo.caption or 'Foto angkatan' }}</p>
|
| 32 |
+
<div class="d-flex justify-content-between align-items-center">
|
| 33 |
+
<small class="text-muted">
|
| 34 |
+
<i class="bi bi-heart-fill text-danger"></i> {{ photo.likes_count }} likes
|
| 35 |
+
</small>
|
| 36 |
+
<small class="text-muted">
|
| 37 |
+
<i class="bi bi-calendar"></i> {{ photo.upload_date.strftime('%d/%m/%Y') }}
|
| 38 |
+
</small>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
{% endfor %}
|
| 44 |
+
</div>
|
| 45 |
+
{% endif %}
|
| 46 |
+
|
| 47 |
+
<!-- All Photos Section -->
|
| 48 |
+
<div class="row">
|
| 49 |
+
<div class="col-12">
|
| 50 |
+
<h2 class="mb-3">Semua Foto</h2>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<div id="photos-container" class="row">
|
| 54 |
+
{% for photo in photos.items %}
|
| 55 |
+
<div class="col-md-4 col-sm-6 mb-4 photo-item" data-photo-id="{{ photo.id }}">
|
| 56 |
+
<div class="card photo-card h-100">
|
| 57 |
+
<img src="{{ url_for('static', filename='uploads/' + photo.filename) }}"
|
| 58 |
+
class="card-img-top" alt="{{ photo.caption }}">
|
| 59 |
+
<div class="card-body">
|
| 60 |
+
<p class="card-text">{{ photo.caption or 'Foto angkatan' }}</p>
|
| 61 |
+
<div class="d-flex justify-content-between align-items-center mb-2">
|
| 62 |
+
<small class="text-muted">
|
| 63 |
+
<i class="bi bi-person-circle"></i> {{ photo.uploader.username }}
|
| 64 |
+
</small>
|
| 65 |
+
<small class="text-muted">
|
| 66 |
+
<i class="bi bi-calendar"></i> {{ photo.upload_date.strftime('%d/%m/%Y') }}
|
| 67 |
+
</small>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="d-flex justify-content-between align-items-center">
|
| 70 |
+
<button class="btn btn-outline-danger btn-sm like-btn" data-photo-id="{{ photo.id }}">
|
| 71 |
+
<i class="bi bi-heart{% if current_user.is_authenticated and photo.likes|selectattr('user_id', 'equalto', current_user.id)|list %}-fill{% endif %}"></i>
|
| 72 |
+
<span class="likes-count">{{ photo.likes_count }}</span>
|
| 73 |
+
</button>
|
| 74 |
+
<a href="{{ url_for('download_photo', photo_id=photo.id) }}" class="btn btn-outline-primary btn-sm">
|
| 75 |
+
<i class="bi bi-download"></i> Download
|
| 76 |
+
</a>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
{% endfor %}
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<!-- Pagination -->
|
| 85 |
+
{% if photos.pages > 1 %}
|
| 86 |
+
<div class="col-12">
|
| 87 |
+
<nav aria-label="Page navigation">
|
| 88 |
+
<ul class="pagination justify-content-center">
|
| 89 |
+
{% if photos.has_prev %}
|
| 90 |
+
<li class="page-item">
|
| 91 |
+
<a class="page-link" href="{{ url_for('index', page=photos.prev_num) }}">Previous</a>
|
| 92 |
+
</li>
|
| 93 |
+
{% endif %}
|
| 94 |
+
|
| 95 |
+
{% for page_num in photos.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
| 96 |
+
{% if page_num %}
|
| 97 |
+
<li class="page-item {% if page_num == photos.page %}active{% endif %}">
|
| 98 |
+
<a class="page-link" href="{{ url_for('index', page=page_num) }}">{{ page_num }}</a>
|
| 99 |
+
</li>
|
| 100 |
+
{% else %}
|
| 101 |
+
<li class="page-item disabled"><span class="page-link">...</span></li>
|
| 102 |
+
{% endif %}
|
| 103 |
+
{% endfor %}
|
| 104 |
+
|
| 105 |
+
{% if photos.has_next %}
|
| 106 |
+
<li class="page-item">
|
| 107 |
+
<a class="page-link" href="{{ url_for('index', page=photos.next_num) }}">Next</a>
|
| 108 |
+
</li>
|
| 109 |
+
{% endif %}
|
| 110 |
+
</ul>
|
| 111 |
+
</nav>
|
| 112 |
+
</div>
|
| 113 |
+
{% endif %}
|
| 114 |
+
</div>
|
| 115 |
+
{% endblock %}
|