33
33
{% endblock styles %}
34
34
35
35
{% block content %}
36
- < div class ="container mt-5 ">
37
- < h2 > {% trans "Stations overview" %}</ h2 >
36
+ < h2 class ="mb-4 mt-5 "> {% trans "Stations overview" %}</ h2 >
38
37
39
- <!-- Display error message if present -->
40
- {% if error %}
41
- < div class ="alert alert-danger " role ="alert ">
42
- {{ error }}
43
- </ div >
44
- {% endif %}
45
-
46
- < div class ="row ">
47
- <!-- Column 1: Top 10 with the highest values -->
48
- < div class ="col-md-6 ">
49
- < h3 class ="text-center "> {% trans "Top 10 with the highest values for PM2.5" %}</ h3 >
50
- < ul class ="list-group ">
51
- {% for station in top_stations %}
52
- < li class ="list-group-item d-flex justify-content-between align-items-center ">
53
- < a href ="{% url 'station-detail' station.0 %} " class ="station-link ">
54
- Station {{ station.0 }}
55
- </ a >
56
- < span class ="badge bg-danger rounded-pill "> {{ station.3 }} µg/m³</ span >
57
- </ li >
58
- {% endfor %}
59
- </ ul >
38
+ <!-- Display error message if present -->
39
+ {% if error %}
40
+ < div class ="alert alert-danger " role ="alert ">
41
+ {{ error }}
42
+ </ div >
43
+ {% else %}
44
+ < div class ="row ">
45
+ <!-- Column 1: Top 10 with the highest values -->
46
+ < div class ="col-md-6 ">
47
+ < h3 class ="text-center "> {% trans "Top 10 with the highest values for PM2.5" %}</ h3 >
48
+ < ul class ="list-group ">
49
+ {% for station in top_stations %}
50
+ < li class ="list-group-item d-flex justify-content-between align-items-center ">
51
+ < a href ="{% url 'station-detail' station.0 %} " class ="station-link ">
52
+ Station {{ station.0 }}
53
+ </ a >
54
+ < span class ="badge bg-danger rounded-pill "> {{ station.3 }} µg/m³</ span >
55
+ </ li >
56
+ {% endfor %}
57
+ </ ul >
60
58
61
- {% if top_stations.has_other_pages %}
62
- < nav aria-label ="{% trans 'Top station pagination' %} ">
63
- < ul class ="pagination justify-content-center mt-2 ">
64
- {% if top_stations.has_previous %}
65
- < li class ="page-item ">
66
- < a class ="page-link " href ="?page_top={{ top_stations.previous_page_number }} " aria-label ="{% trans 'Previous' %} ">
67
- < span aria-hidden ="true "> «</ span >
68
- </ a >
59
+ {% if top_stations.has_other_pages %}
60
+ < nav aria-label ="{% trans 'Top station pagination' %} ">
61
+ < ul class ="pagination justify-content-center mt-2 ">
62
+ {% if top_stations.has_previous %}
63
+ < li class ="page-item ">
64
+ < a class ="page-link " href ="?page_top={{ top_stations.previous_page_number }} " aria-label ="{% trans 'Previous' %} ">
65
+ < span aria-hidden ="true "> «</ span >
66
+ </ a >
67
+ </ li >
68
+ {% else %}
69
+ < li class ="page-item disabled ">
70
+ < span class ="page-link " aria-hidden ="true "> «</ span >
71
+ </ li >
72
+ {% endif %}
73
+
74
+ {% for num in paginator_top.page_range %}
75
+ {% if top_stations.number == num %}
76
+ < li class ="page-item active " aria-current ="page ">
77
+ < span class ="page-link "> {{ num }}</ span >
69
78
</ li >
70
- {% else %}
71
- < li class ="page-item disabled ">
72
- < span class ="page-link " aria-hidden ="true "> «</ span >
73
- </ li >
74
- {% endif %}
75
-
76
- {% for num in paginator_top.page_range %}
77
- {% if top_stations.number == num %}
78
- < li class ="page-item active " aria-current ="page ">
79
- < span class ="page-link "> {{ num }}</ span >
80
- </ li >
81
- {% elif num > top_stations.number|add:'-3' and num < top _stations.number|add: '3' %}
82
- < li class ="page-item ">
83
- < a class ="page-link " href ="?page_top={{ num }} "> {{ num }}</ a >
84
- </ li >
85
- {% endif %}
86
- {% endfor %}
87
-
88
- {% if top_stations.has_next %}
79
+ {% elif num > top_stations.number|add:'-3' and num < top _stations.number|add: '3' %}
89
80
< li class ="page-item ">
90
- < a class ="page-link " href ="?page_top={{ top_stations.next_page_number }} " aria-label ="{% trans 'Next' %} ">
91
- < span aria-hidden ="true "> »</ span >
92
- </ a >
93
- </ li >
94
- {% else %}
95
- < li class ="page-item disabled ">
96
- < span class ="page-link " aria-hidden ="true "> »</ span >
81
+ < a class ="page-link " href ="?page_top={{ num }} "> {{ num }}</ a >
97
82
</ li >
98
83
{% endif %}
99
- </ ul >
100
- </ nav >
101
- {% endif %}
102
- </ div >
84
+ {% endfor %}
85
+
86
+ {% if top_stations.has_next %}
87
+ < li class ="page-item ">
88
+ < a class ="page-link " href ="?page_top={{ top_stations.next_page_number }} " aria-label ="{% trans 'Next' %} ">
89
+ < span aria-hidden ="true "> »</ span >
90
+ </ a >
91
+ </ li >
92
+ {% else %}
93
+ < li class ="page-item disabled ">
94
+ < span class ="page-link " aria-hidden ="true "> »</ span >
95
+ </ li >
96
+ {% endif %}
97
+ </ ul >
98
+ </ nav >
99
+ {% endif %}
100
+ </ div >
103
101
104
- <!-- Column 2: Top 10 with the lowest values -->
105
- < div class ="col-md-6 ">
106
- < h3 class ="text-center "> {% trans "Top 10 with the lowest values for PM2.5" %}</ h3 >
107
- < ul class ="list-group ">
108
- {% for station in lowest_stations %}
109
- < li class ="list-group-item d-flex justify-content-between align-items-center ">
110
- < a href ="{% url 'station-detail' station.0 %} " class ="station-link ">
111
- Station {{ station.0 }}
112
- </ a >
113
- < span class ="badge bg-success rounded-pill "> {{ station.3 }} µg/m³</ span >
114
- </ li >
115
- {% endfor %}
116
- </ ul >
102
+ <!-- Column 2: Top 10 with the lowest values -->
103
+ < div class ="col-md-6 ">
104
+ < h3 class ="text-center "> {% trans "Top 10 with the lowest values for PM2.5" %}</ h3 >
105
+ < ul class ="list-group ">
106
+ {% for station in lowest_stations %}
107
+ < li class ="list-group-item d-flex justify-content-between align-items-center ">
108
+ < a href ="{% url 'station-detail' station.0 %} " class ="station-link ">
109
+ Station {{ station.0 }}
110
+ </ a >
111
+ < span class ="badge bg-success rounded-pill "> {{ station.3 }} µg/m³</ span >
112
+ </ li >
113
+ {% endfor %}
114
+ </ ul >
117
115
118
- {% if lowest_stations.has_other_pages %}
119
- < nav aria-label ="{% trans 'Lowest station pagination' %} ">
120
- < ul class ="pagination justify-content-center mt-2 ">
121
- {% if lowest_stations.has_previous %}
122
- < li class ="page-item ">
123
- < a class ="page-link " href ="?page_low={{ lowest_stations.previous_page_number }} " aria-label ="{% trans 'Previous' %} ">
124
- < span aria-hidden ="true "> «</ span >
125
- </ a >
126
- </ li >
127
- {% else %}
128
- < li class ="page-item disabled ">
129
- < span class ="page-link " aria-hidden ="true "> «</ span >
116
+ {% if lowest_stations.has_other_pages %}
117
+ < nav aria-label ="{% trans 'Lowest station pagination' %} ">
118
+ < ul class ="pagination justify-content-center mt-2 ">
119
+ {% if lowest_stations.has_previous %}
120
+ < li class ="page-item ">
121
+ < a class ="page-link " href ="?page_low={{ lowest_stations.previous_page_number }} " aria-label ="{% trans 'Previous' %} ">
122
+ < span aria-hidden ="true "> «</ span >
123
+ </ a >
124
+ </ li >
125
+ {% else %}
126
+ < li class ="page-item disabled ">
127
+ < span class ="page-link " aria-hidden ="true "> «</ span >
128
+ </ li >
129
+ {% endif %}
130
+
131
+ {% for num in paginator_low.page_range %}
132
+ {% if lowest_stations.number == num %}
133
+ < li class ="page-item active " aria-current ="page ">
134
+ < span class ="page-link "> {{ num }}</ span >
130
135
</ li >
131
- {% endif %}
132
-
133
- {% for num in paginator_low.page_range %}
134
- {% if lowest_stations.number == num %}
135
- < li class ="page-item active " aria-current ="page ">
136
- < span class ="page-link "> {{ num }}</ span >
137
- </ li >
138
- {% elif num > lowest_stations.number|add:'-3' and num < lowest _stations.number|add: '3' %}
139
- < li class ="page-item ">
140
- < a class ="page-link " href ="?page_low={{ num }} "> {{ num }}</ a >
141
- </ li >
142
- {% endif %}
143
- {% endfor %}
144
-
145
- {% if lowest_stations.has_next %}
136
+ {% elif num > lowest_stations.number|add:'-3' and num < lowest _stations.number|add: '3' %}
146
137
< li class ="page-item ">
147
- < a class ="page-link " href ="?page_low={{ lowest_stations.next_page_number }} " aria-label ="{% trans 'Next' %} ">
148
- < span aria-hidden ="true "> »</ span >
149
- </ a >
150
- </ li >
151
- {% else %}
152
- < li class ="page-item disabled ">
153
- < span class ="page-link " aria-hidden ="true "> »</ span >
138
+ < a class ="page-link " href ="?page_low={{ num }} "> {{ num }}</ a >
154
139
</ li >
155
140
{% endif %}
156
- </ ul >
157
- </ nav >
158
- {% endif %}
159
- </ div >
141
+ {% endfor %}
142
+
143
+ {% if lowest_stations.has_next %}
144
+ < li class ="page-item ">
145
+ < a class ="page-link " href ="?page_low={{ lowest_stations.next_page_number }} " aria-label ="{% trans 'Next' %} ">
146
+ < span aria-hidden ="true "> »</ span >
147
+ </ a >
148
+ </ li >
149
+ {% else %}
150
+ < li class ="page-item disabled ">
151
+ < span class ="page-link " aria-hidden ="true "> »</ span >
152
+ </ li >
153
+ {% endif %}
154
+ </ ul >
155
+ </ nav >
156
+ {% endif %}
160
157
</ div>
161
158
</ div>
159
+ {% endif %}
162
160
{% endblock content %}
0 commit comments