Пример #1
0
func fCourses(C *F.Cache, args []string) F.Fragment {
	C.Depends("courses",
		"/courses",
		"/templates",
	)
	return F.MustParse(exec("courses", content.Courses()))
}
Пример #2
0
func fItemFragment(C *F.Cache, args []string) F.Fragment {
	C.Depends(args[0]+" "+args[1],
		"/content/"+args[1],
		"/templates",
	)
	return F.MustParse(exec(args[0], content.Get(args[1])))
}
Пример #3
0
func fItem(C *F.Cache, args []string) F.Fragment {
	item := content.Get(args[1])
	C.Depends("item "+args[1],
		"/content/"+args[1],
		"/templates",
	)
	if topic, ok := item.(*content.Topic); ok {
		for _, subitems := range topic.Children() {
			C.Depends("item "+args[1], "/content/"+subitems.Id)
		}
	}
	return F.MustParse(exec(item.Type(), item))
}
Пример #4
0
func fNavbar(c *F.Cache, args []string) F.Fragment {
	fmt.Printf("fNavbar: args = %v\n", args)
	fid := strings.Join(args, " ")
	c.Depends(fid, "/templates")
	var info navbarInfo
	if len(args) > 1 {
		session := data.FindSession(args[1])
		info.User = session.User
		c.Depends(fid, "/session/"+session.Id)
		if len(session.Message) > 0 {
			info.Message = &session.Message
		}
	}
	return F.MustParse(exec(args[0], info))
}