Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix translation issues station detail #65

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@

TIME_ZONE = 'Europe/Vienna'
USE_I18N = True
USE_L10N = True
USE_L10N = False
USE_TZ = True

LOCALE_PATHS = [
Expand Down
30 changes: 19 additions & 11 deletions app/templates/stations/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/cal-heatmap.css" />

<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/cal-heatmap.min.js"></script>
{% endblock styles %}

{% block content %}
Expand Down Expand Up @@ -119,30 +122,35 @@ <h5>{% trans "Download data" %}</h5>
</div>
</div>

<!-- Lade die erforderlichen JS-Dateien -->
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/cal-heatmap.min.js"></script>

<!-- JavaScript-Code zur Initialisierung der Karte und Diagramme -->
<script>
// Initialisierung der Leaflet-Karte
var map = L.map('map').setView([{{ station.coordinates.1 }}, {{ station.coordinates.0 }}], 13); // Beispielkoordinaten (Wien)
var map = L.map('map').setView([{{ station.coordinates.1|stringformat:"f" }}, {{ station.coordinates.0|stringformat:"f" }}], 13); // Beispielkoordinaten (Wien)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(map);

// Marker hinzufügen
L.marker([{{ station.coordinates.1 }}, {{ station.coordinates.0 }}]).addTo(map)
L.marker([{{ station.coordinates.1|stringformat:"f" }}, {{ station.coordinates.0|stringformat:"f" }}]).addTo(map)
.bindPopup('Station {{ station.id }}')
.openPopup();

// Daten für die Diagramme
var labels = [];
var now = new Date(); // Aktuelle Zeit


for (var i = 48; i > 0; i--) {
labels.push(i + 'h');
var pastTime = new Date(now.getTime() - i * 60 * 60 * 1000); // Subtrahiere i Stunden

var day = pastTime.getDate().toString().padStart(2, '0'); // Tag
var month = (pastTime.getMonth() + 1).toString().padStart(2, '0'); // Monat
var hours = pastTime.getHours().toString().padStart(2, '0'); // Stunden

var formattedLabel = `${day}.${month}. ${hours}:00`; // Format TT.MM. HH
labels.push(formattedLabel);
}


var dataPM25 = [];
var dataPM10 = [];
var dataPM1 = [];
Expand Down Expand Up @@ -176,8 +184,8 @@ <h5>{% trans "Download data" %}</h5>
display: false
},
ticks: {
maxRotation: 90,
minRotation: 90,
maxRotation: 35,
minRotation: 35,
autoSkip: true,
maxTicksLimit: 10
}
Expand Down
Loading