From 03b01bd425bc76622b3e13ec0d470e4acebc966a Mon Sep 17 00:00:00 2001 From: alexanderkohler1 <alexander1.kohler@student.reutlingen-university.de> Date: Sun, 15 Jun 2025 20:55:59 +0200 Subject: [PATCH] =?UTF-8?q?Projekt-Ansichten=20um=20K=C3=BCrzel-Anzeige=20?= =?UTF-8?q?erweitert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Kürzel-Badges in Projekt-Details und Listen hinzugefügt - Verbesserte Benutzeroberfläche für Projekt-Aktionen - Fallback-Behandlung für leere Datumsfelder --- templates/project/_detail.go.html | 11 +++++- templates/project/_list.go.html | 58 ++++++++++++++----------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/templates/project/_detail.go.html b/templates/project/_detail.go.html index 5d25f28..a76a835 100644 --- a/templates/project/_detail.go.html +++ b/templates/project/_detail.go.html @@ -9,9 +9,12 @@ <div> <!-- Main project name as page heading --> <h1 class="mb-1">{{ .Data.Project.Name }}</h1> - <!-- Subheading with project ID badge and date range --> + <!-- Subheading with project ID, shortcut badges and date range --> <p class="text-muted mb-0"> <span class="badge bg-secondary me-2">{{ .Data.Project.ProjectID }}</span> + {{ if .Data.Project.Shortcut }} + <span class="badge bg-primary me-2">{{ .Data.Project.Shortcut }}</span> + {{ end }} {{ .Data.Project.StartDate.Format "02.01.2006" }} - {{ .Data.Project.EndDate.Format "02.01.2006" }} </p> </div> @@ -95,6 +98,12 @@ <dt class="col-sm-3">Projekt-ID:</dt> <dd class="col-sm-9">{{ .Data.Project.ProjectID }}</dd> + <!-- Project shortcut field --> + {{ if .Data.Project.Shortcut }} + <dt class="col-sm-3">Kürzel:</dt> + <dd class="col-sm-9"><span class="badge bg-primary">{{ .Data.Project.Shortcut }}</span></dd> + {{ end }} + <!-- Project name field --> <dt class="col-sm-3">Name:</dt> <dd class="col-sm-9">{{ .Data.Project.Name }}</dd> diff --git a/templates/project/_list.go.html b/templates/project/_list.go.html index 2bf782c..36eef07 100644 --- a/templates/project/_list.go.html +++ b/templates/project/_list.go.html @@ -23,38 +23,34 @@ <!-- Bootstrap card component with shadow for visual depth --> <div class="card h-100 shadow-sm project-card"> - <!-- Card header with project ID and actions dropdown --> + <!-- Card header with project ID, shortcut and actions dropdown --> <div class="card-header d-flex justify-content-between align-items-center"> - <!-- Display human-readable project ID (e.g., PRJ-2025-001) --> - <h6 class="mb-0 text-muted">{{ .ProjectID }}</h6> + <!-- Display human-readable project ID and shortcut --> + <div> + <h6 class="mb-0 text-muted">{{ .ProjectID }}</h6> + {{ if .Shortcut }} + <small class="badge bg-primary">{{ .Shortcut }}</small> + {{ end }} + </div> - <!-- Bootstrap dropdown for project actions (edit, delete) --> - <div class="dropdown"> - <button class="btn btn-sm btn-outline-secondary dropdown-toggle" - type="button" - data-bs-toggle="dropdown"> - ⋮ + <!-- Project action buttons (edit, delete) --> + <div class="btn-group" role="group"> + <!-- Edit button using HTMX for seamless navigation --> + <a class="btn btn-sm btn-outline-primary" + href="/project/{{ .ID.Hex }}/edit" + hx-boost="true" + hx-target="body" + title="Bearbeiten"> + ✏️ + </a> + <!-- Delete button triggers modal for confirmation --> + <button class="btn btn-sm btn-outline-danger" + type="button" + data-bs-toggle="modal" + data-bs-target="#deleteModal-{{ .ID.Hex }}" + title="Löschen"> + 🗑️ </button> - <ul class="dropdown-menu"> - <li> - <!-- Edit link using HTMX for seamless navigation --> - <a class="dropdown-item" - href="/project/{{ .ID.Hex }}/edit" - hx-boost="true" - hx-target="body"> - ✏️ Bearbeiten - </a> - </li> - <li><hr class="dropdown-divider"></li> - <li> - <!-- Delete button triggers modal for confirmation --> - <button class="dropdown-item text-danger" - data-bs-toggle="modal" - data-bs-target="#deleteModal-{{ .ID.Hex }}"> - 🗑️ Löschen - </button> - </li> - </ul> </div> </div> @@ -82,10 +78,10 @@ <!-- Project timeline showing start and end dates --> <div class="d-flex justify-content-between text-small text-muted"> <span> - 📅 {{ .StartDate.Format "02.01.2006" }} + 📅 {{ if .StartDate.IsZero }}Nicht festgelegt{{ else }}{{ .StartDate.Format "02.01.2006" }}{{ end }} </span> <span> - 🏁 {{ .EndDate.Format "02.01.2006" }} + 🏁 {{ if .EndDate.IsZero }}Nicht festgelegt{{ else }}{{ .EndDate.Format "02.01.2006" }}{{ end }} </span> </div> </div> -- GitLab