-
Notifications
You must be signed in to change notification settings - Fork 20
/
individual_page.go
55 lines (49 loc) 路 1.78 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
indexLetters []rune
}
func NewIndividualPage(document *gedcom.Document, individual *gedcom.IndividualNode, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune) *IndividualPage {
return &IndividualPage{
document: document,
individual: individual,
googleAnalyticsID: googleAnalyticsID,
options: options,
indexLetters: indexLetters,
}
}
func (c *IndividualPage) WriteHTMLTo(w io.Writer) (int64, error) {
name := c.individual.Names()[0]
individualName := NewIndividualName(c.individual, c.options.LivingVisibility,
UnknownEmphasis)
individualDates := NewIndividualDates(c.individual, c.options.LivingVisibility)
return core.NewPage(
name.String(),
core.NewComponents(
NewPublishHeader(c.document, name.String(), selectedExtraTab, c.options, c.indexLetters),
NewAllParentButtons(c.document, c.individual, c.options.LivingVisibility),
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.options.LivingVisibility),
core.NewSpace(),
NewPartnersAndChildren(c.document, c.individual, c.options.LivingVisibility),
),
c.googleAnalyticsID,
).WriteHTMLTo(w)
}