UI verbessert
This commit is contained in:
1 parent
cc2e85c111
commit
a5d4251868
10 files changed
+136
-83
No files matched your search
+6
-13
@@ -623,7 +623,7 @@ func CompactPlan(w io.Writer, r domain.DayRange, rows []domain.DayPlanRow, peopl
|
||||
contentTop := margin + headerH + colH + 2
|
||||
contentBottom := pageHeight - margin - footerH
|
||||
|
||||
drawHeader := func(continuation bool) {
|
||||
drawHeader := func() {
|
||||
setColor(pdf, colors.accent)
|
||||
pdf.SetFont("Helvetica", "B", 6.2)
|
||||
pdf.SetXY(margin, margin)
|
||||
@@ -631,12 +631,8 @@ func CompactPlan(w io.Writer, r domain.DayRange, rows []domain.DayPlanRow, peopl
|
||||
|
||||
setColor(pdf, colors.ink)
|
||||
pdf.SetFont("Times", "B", 17)
|
||||
title := "Gottesdienstliste"
|
||||
if continuation {
|
||||
title = "Gottesdienstliste · Fortsetzung"
|
||||
}
|
||||
pdf.SetXY(margin, margin+4.4)
|
||||
pdf.CellFormat(130, 6.5, tr(title), "", 0, "L", false, 0, "")
|
||||
pdf.CellFormat(130, 6.5, tr("Gottesdienstliste"), "", 0, "L", false, 0, "")
|
||||
|
||||
setColor(pdf, colors.secondary)
|
||||
pdf.SetFont("Helvetica", "", 7.8)
|
||||
@@ -645,13 +641,10 @@ func CompactPlan(w io.Writer, r domain.DayRange, rows []domain.DayPlanRow, peopl
|
||||
|
||||
rightX := pageWidth - margin - 62
|
||||
setColor(pdf, colors.tertiary)
|
||||
pdf.SetFont("Helvetica", "B", 6.4)
|
||||
pdf.SetXY(rightX, margin)
|
||||
pdf.CellFormat(62, 3.2, tr("A4 hoch · kompakte Liste"), "", 0, "R", false, 0, "")
|
||||
pdf.SetFont("Helvetica", "", 6.4)
|
||||
pdf.SetXY(rightX, margin+4.5)
|
||||
pdf.SetXY(rightX, margin)
|
||||
pdf.CellFormat(62, 3.2, tr("Erstellt am "+domain.MediumString(opts.generated())), "", 0, "R", false, 0, "")
|
||||
pdf.SetXY(rightX, margin+9)
|
||||
pdf.SetXY(rightX, margin+4.5)
|
||||
pdf.CellFormat(62, 3.2, tr("Daten von www.eucharistiefeier.de"), "", 0, "R", false, 0, "")
|
||||
|
||||
setDraw(pdf, colors.line)
|
||||
@@ -714,7 +707,7 @@ func CompactPlan(w io.Writer, r domain.DayRange, rows []domain.DayPlanRow, peopl
|
||||
}
|
||||
|
||||
pdf.AddPage()
|
||||
drawHeader(false)
|
||||
drawHeader()
|
||||
drawColumnHeader()
|
||||
page := 1
|
||||
y := contentTop
|
||||
@@ -744,7 +737,7 @@ func CompactPlan(w io.Writer, r domain.DayRange, rows []domain.DayPlanRow, peopl
|
||||
drawFooter(page)
|
||||
page++
|
||||
pdf.AddPage()
|
||||
drawHeader(true)
|
||||
drawHeader()
|
||||
drawColumnHeader()
|
||||
y = contentTop
|
||||
}
|
||||
|
||||
@@ -279,3 +279,32 @@ func TestCompactPlan(t *testing.T) {
|
||||
t.Fatalf("unexpected PDF output (%d bytes)", buf.Len())
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompactPlanPaginatesWithoutContinuationTitle(t *testing.T) {
|
||||
r, rows, _, people := multiPageRows()
|
||||
var buf bytes.Buffer
|
||||
if err := CompactPlan(&buf, r, rows, people, Options{TenantName: "Bad Godesberg"}); err != nil {
|
||||
t.Fatalf("render: %v", err)
|
||||
}
|
||||
content := string(pdfContentStreams(t, buf.Bytes()))
|
||||
if strings.Contains(content, "Fortsetzung") {
|
||||
t.Fatal("continuation title must not appear on later pages")
|
||||
}
|
||||
if strings.Contains(content, "A4 hoch") {
|
||||
t.Fatal("paper hint must not appear in the compact header")
|
||||
}
|
||||
match := regexp.MustCompile(`Seite 1 von (\d+)`).FindStringSubmatch(content)
|
||||
if match == nil {
|
||||
t.Fatalf("first page footer is missing the total page count:\n%s", content)
|
||||
}
|
||||
total, err := strconv.Atoi(match[1])
|
||||
if err != nil || total < 2 {
|
||||
t.Fatalf("total pages = %q, want at least 2", match[1])
|
||||
}
|
||||
if !strings.Contains(content, fmt.Sprintf("Seite %d von %d", total, total)) {
|
||||
t.Fatalf("last page footer is missing: want Seite %d von %d", total, total)
|
||||
}
|
||||
if got := strings.Count(content, "Seite "); got != total {
|
||||
t.Fatalf("footer count = %d, want %d", got, total)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user