Пример #1
0
func Latest(ctx banana.Context) error {
	ps := post.Query(0, 10)
	layout := ThemeLayout{}
	layout.Content = ThemeBlock{theme.UI("home"), ps}
	return ctx.Tpl(theme.UI("layout"), layout)
	/*
		posts, err := models.ZRange("pubtime", 0, 4)
		if err != nil {
			log.Fatal(err)
		}
		ctx.Tpl("home", posts)
	*/
}
Пример #2
0
func Posts(ctx banana.Context) error {

	err := Auth(ctx, PrivilegePostRead)
	switch err {
	case ErrNoPermit:
		return err
	case ErrNotLogin:
		http.Redirect(ctx.Res(), ctx.Req(), "/login?error&u=/cp/posts", http.StatusFound)
		return nil
	case nil:
	default:
		return err
	}

	ps := post.Query(0, 10)
	layout := ThemeLayout{}
	layout.Content = ThemeBlock{theme.CP("posts"), ps}
	return ctx.Tpl(theme.CP("layout"), layout)
}
Пример #3
0
func Query(ctx banana.Context) error {
	posts := post.Query(0, 10)
	layout := HomeLayout{}
	layout.Content = posts
	return ctx.Tpl(theme.UI("home"), layout)
}