mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Fix showing photos on the trip edit page
This commit is contained in:
parent
e8842a9476
commit
be0bc35955
4 changed files with 10 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
|
@ -41,5 +41,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.trix-content {
|
.trix-content {
|
||||||
min-height: 20rem;
|
min-height: 10rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ export default class extends Controller {
|
||||||
static values = { }
|
static values = { }
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
|
if (!this.hasContainerTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Trips controller connected")
|
console.log("Trips controller connected")
|
||||||
this.coordinates = JSON.parse(this.containerTarget.dataset.coordinates)
|
this.coordinates = JSON.parse(this.containerTarget.dataset.coordinates)
|
||||||
this.apiKey = this.containerTarget.dataset.api_key
|
this.apiKey = this.containerTarget.dataset.api_key
|
||||||
|
|
@ -77,7 +81,6 @@ export default class extends Controller {
|
||||||
const firstCoord = this.coordinates[0];
|
const firstCoord = this.coordinates[0];
|
||||||
const lastCoord = this.coordinates[this.coordinates.length - 1];
|
const lastCoord = this.coordinates[this.coordinates.length - 1];
|
||||||
|
|
||||||
// Convert Unix timestamp to a Date object
|
|
||||||
const startDate = new Date(firstCoord[4] * 1000).toISOString().split('T')[0];
|
const startDate = new Date(firstCoord[4] * 1000).toISOString().split('T')[0];
|
||||||
const endDate = new Date(lastCoord[4] * 1000).toISOString().split('T')[0];
|
const endDate = new Date(lastCoord[4] * 1000).toISOString().split('T')[0];
|
||||||
|
|
||||||
|
|
@ -130,7 +133,6 @@ export default class extends Controller {
|
||||||
marker.bindPopup(popupContent)
|
marker.bindPopup(popupContent)
|
||||||
|
|
||||||
// Add to markers layer instead of directly to map
|
// Add to markers layer instead of directly to map
|
||||||
|
|
||||||
marker.addTo(this.markersLayer)
|
marker.addTo(this.markersLayer)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -160,8 +162,10 @@ export default class extends Controller {
|
||||||
this.coordinates = newCoordinates.map(point => [
|
this.coordinates = newCoordinates.map(point => [
|
||||||
parseFloat(point.latitude),
|
parseFloat(point.latitude),
|
||||||
parseFloat(point.longitude),
|
parseFloat(point.longitude),
|
||||||
|
point.id,
|
||||||
|
null, // This is so we can use the same order and position of elements in the coordinates object as in the api/v1/points response
|
||||||
(point.timestamp).toString()
|
(point.timestamp).toString()
|
||||||
])
|
]).sort((a, b) => a[4] - b[4]);
|
||||||
|
|
||||||
// Clear existing layers
|
// Clear existing layers
|
||||||
this.markersLayer.clearLayers()
|
this.markersLayer.clearLayers()
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="min-h-20">
|
<div>
|
||||||
<%= @trip.field_notes.body %>
|
<%= @trip.field_notes.body %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue