-
Notifications
You must be signed in to change notification settings - Fork 20
/
individual_page.go
55 lines (49 loc) 路 1.71 KB
/
individual_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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package html
import (
"github.com/elliotchance/gedcom"
"github.com/elliotchance/gedcom/html/core"
"io"
)
// IndividualPage is the page that shows detailed information about an
// individual.
type IndividualPage struct {
document *gedcom.Document
individual *gedcom.IndividualNode
googleAnalyticsID string
options PublishShowOptions
visibility LivingVisibility
}
func NewIndividualPage(document *gedcom.Document, individual *gedcom.IndividualNode, googleAnalyticsID string, options PublishShowOptions, visibility LivingVisibility) *IndividualPage {
return &IndividualPage{
document: document,
individual: individual,
googleAnalyticsID: googleAnalyticsID,
options: options,
visibility: visibility,
}
}
func (c *IndividualPage) WriteHTMLTo(w io.Writer) (int64, error) {
name := c.individual.Names()[0]
individualName := NewIndividualName(c.individual, c.visibility,
UnknownEmphasis)
individualDates := NewIndividualDates(c.individual, c.visibility)
return core.NewPage(
name.String(),
core.NewComponents(
NewPublishHeader(c.document, name.String(), selectedExtraTab, c.options),
NewAllParentButtons(c.document, c.individual, c.visibility),
core.NewBigTitle(1, individualName),
core.NewBigTitle(3, individualDates),
core.NewHorizontalRuleRow(),
core.NewRow(
core.NewColumn(core.HalfRow, NewIndividualNameAndSex(c.individual)),
core.NewColumn(core.HalfRow, NewIndividualAdditionalNames(c.individual)),
),
core.NewSpace(),
newIndividualEvents(c.document, c.individual, c.visibility),
core.NewSpace(),
NewPartnersAndChildren(c.document, c.individual, c.visibility),
),
c.googleAnalyticsID,
).WriteHTMLTo(w)
}