示例#1
0
func NewIndex_html(locale string, payload Payload_Index_html) templates.Template {

	authorCards := make([]*prototype.AuthorCard, len(payload.AuthorIds))
	components := make([]templates.IStrongoComponent, len(authorCards))
	for i, authorId := range payload.AuthorIds {
		authorCardPayload := prototype.AuthorCard_Payload{AuthorId: authorId}
		authorCard := prototype.NewAuthorCard(authorCardPayload)
		authorCards[i] = authorCard
		components[i] = authorCard
	}
	template := Index_html{
		i18n:        I18Storage[locale],
		payload:     payload,
		authorCards: authorCards,
	}

	template.component = templates.NewStrongoComponent(components)

	template.extends = New_layout_html_struct(
		template.i18n,
		template,
		Payload_Layout_html{BgColor: payload.BgColor},
	)
	return template
}
示例#2
0
func NewAuthorCard(payload AuthorCard_Payload) *AuthorCard {
	return &AuthorCard{
		component: templates.NewStrongoComponent(nil),
		payload:   payload,
	}
}