rastof9 commited on
Commit
397653d
·
verified ·
1 Parent(s): e028acb

Create templates/dashboard.html

Browse files
Files changed (1) hide show
  1. app/templates/dashboard.html +37 -0
app/templates/dashboard.html ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.html" %}
2
+
3
+ {% block content %}
4
+ <div class="filters">
5
+ <input type="text" name="query" placeholder="Search ads..." value="{{ query }}">
6
+ <select name="sentiment">
7
+ <option value="">All Sentiments</option>
8
+ <option value="Positive" {% if sentiment_filter == "Positive" %}selected{% endif %}>Positive</option>
9
+ <option value="Negative" {% if sentiment_filter == "Negative" %}selected{% endif %}>Negative</option>
10
+ </select>
11
+ <button type="button" onclick="applyFilters()">Apply</button>
12
+ </div>
13
+
14
+ <div class="ads-list">
15
+ {% for ad in ads.items %}
16
+ <div class="ad-card">
17
+ <p>{{ ad.content }}</p>
18
+ <span class="sentiment">{{ ad.sentiment }}</span>
19
+ </div>
20
+ {% endfor %}
21
+ </div>
22
+
23
+ <div class="pagination">
24
+ {% for p in range(1, ads.pages + 1) %}
25
+ <a href="?page={{ p }}&query={{ query }}&sentiment={{ sentiment_filter }}"
26
+ class="{% if p == ads.page %}active{% endif %}">{{ p }}</a>
27
+ {% endfor %}
28
+ </div>
29
+
30
+ <script>
31
+ function applyFilters() {
32
+ const query = document.querySelector('input[name="query"]').value;
33
+ const sentiment = document.querySelector('select[name="sentiment"]').value;
34
+ window.location.href = `?query=${query}&sentiment=${sentiment}`;
35
+ }
36
+ </script>
37
+ {% endblock %}