feat(komoot): prefill import date range with current year
Signed-off-by: Marcus Fihlon <marcus@fihlon.swiss>
This commit is contained in:
parent
70e7632699
commit
8a900ccd30
2 changed files with 7 additions and 2 deletions
|
|
@ -4,6 +4,8 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serves the Komoot import preview page.
|
* Serves the Komoot import preview page.
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,7 +14,10 @@ public class KomootImportViewController {
|
||||||
|
|
||||||
@GetMapping("/komoot-import")
|
@GetMapping("/komoot-import")
|
||||||
public String komootImportPage(Model model) {
|
public String komootImportPage(Model model) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
model.addAttribute("pageTitle", "Komoot Import");
|
model.addAttribute("pageTitle", "Komoot Import");
|
||||||
|
model.addAttribute("defaultStartDate", today.withDayOfYear(1));
|
||||||
|
model.addAttribute("defaultEndDate", today);
|
||||||
return "activities/komoot";
|
return "activities/komoot";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,11 @@
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="startDate" class="form-label">Start Date</label>
|
<label for="startDate" class="form-label">Start Date</label>
|
||||||
<input type="date" class="form-control" id="startDate" name="startDate">
|
<input type="date" class="form-control" id="startDate" name="startDate" th:value="${defaultStartDate}">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="endDate" class="form-label">End Date</label>
|
<label for="endDate" class="form-label">End Date</label>
|
||||||
<input type="date" class="form-control" id="endDate" name="endDate">
|
<input type="date" class="form-control" id="endDate" name="endDate" th:value="${defaultEndDate}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text">Both dates must be set together. Inclusive, day-based filter.</div>
|
<div class="form-text">Both dates must be set together. Inclusive, day-based filter.</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue