Documentation
¶
Overview ¶
Package theme is the owner's look for the app: its name, palette, brand colour, corner shape and fonts, kept in one database row and served at /api/roux/theme. Whatever the owner has not chosen is the application's default, so the answer is always a whole theme. The page itself carries the saved theme too (see kit/spa), so the first paint already looks right.
GET /api/roux/theme anyone, signed out too: the page needs it before sign-in PUT /api/roux/theme whoever holds theme.manage, from the version they read
Index ¶
Constants ¶
const Path = "/api/roux/theme"
Path is where the theme is served.
const ThemeManage = "theme.manage"
ThemeManage lets someone change the theme. The migration grants it to OWNER.
Variables ¶
var Migration = pgdb.Migration{Name: "roux-theme", FS: migrations, Dir: "migrations", After: []string{"roux-authz"}}
Migration is the theme's schema. It runs after the roles, whose OWNER it grants ThemeManage.
Functions ¶
Types ¶
type Request ¶
type Request struct {
AppName *string `json:"appName"`
Palette *string `json:"palette"`
BrandColor *string `json:"brandColor"`
Shape *string `json:"shape"`
HeadingFont *string `json:"headingFont"`
BodyFont *string `json:"bodyFont"`
Version *int64 `json:"version"`
}
Request is the owner's new theme, edited from Version. Members are pointers so that one left out is told apart from one that is blank.
type Response ¶
type Response struct {
AppName string `json:"appName"`
Palette string `json:"palette"`
BrandColor string `json:"brandColor"`
Shape string `json:"shape"`
HeadingFont string `json:"headingFont"`
BodyFont string `json:"bodyFont"`
Version int64 `json:"version"`
}
Response is the theme as the API answers it: every part, the owner's or the application's default, and the version an edit must send back (0 until the owner first saves).
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Defaults spa.Theme // for every part the owner has not chosen
Clock func() time.Time
}
Service reads and changes the theme.
func (Service) Current ¶
Current is the theme as it looks now, and the version an edit must be made from.