Example #1
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])))
}
Example #2
0
func getTitle(id string) (title string) {
	switch id {
	case "":
		title = "Inicio"
	case "cursos":
		title = "Cursos"
	default:
		title = content.Get(id).Data().Title
	}
	return
}
Example #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))
}
Example #4
0
func hPhotos(w http.ResponseWriter, req *http.Request) {
	id := req.URL.Path[len("/png/"):]
	item := content.Get(id)
	if item == nil {
		NotFound(w, req)
		return
	}
	course, ok := item.(*content.Course)
	if !ok {
		NotFound(w, req)
		return
	}
	ServeFile(w, req, course.Photo)
}
Example #5
0
func getFragmentID(id string) (fid string, notfound bool) {
	switch id {
	case "":
		fid = "home"
	case "cursos":
		fid = "courses"
	default:
		item := content.Get(id)
		if item == nil {
			return "", true
		}
		fid = fmt.Sprintf("item %s", id)
	}
	return
}