-
Notifications
You must be signed in to change notification settings - Fork 20
/
family_list_page.go
41 lines (34 loc) 路 1.18 KB
/
family_list_page.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package html
import (
"github.com/elliotchance/gedcom"
"github.com/elliotchance/gedcom/html/core"
"io"
)
type FamilyListPage struct {
document *gedcom.Document
googleAnalyticsID string
options *PublishShowOptions
indexLetters []rune
}
func NewFamilyListPage(document *gedcom.Document, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune) *FamilyListPage {
return &FamilyListPage{
document: document,
googleAnalyticsID: googleAnalyticsID,
options: options,
indexLetters: indexLetters,
}
}
func (c *FamilyListPage) WriteHTMLTo(w io.Writer) (int64, error) {
table := []core.Component{
core.NewTableHead("Husband", "Date", "Wife"),
}
for _, family := range c.document.Families() {
familyInList := NewFamilyInList(c.document, family, c.options.LivingVisibility)
table = append(table, familyInList)
}
column := core.NewColumn(core.EntireRow, core.NewTable("", table...))
header := NewPublishHeader(c.document, "", selectedFamiliesTab, c.options, c.indexLetters)
components := core.NewComponents(header, core.NewRow(column))
return core.NewPage("Families", components, c.googleAnalyticsID).
WriteHTMLTo(w)
}