{{template "base" .Base}}
{{if .EditMode}}

{{else}}

{{.Comic.Title}}

{{end}} {{if not .EditMode}} {{if .User.Flag.Comics}}
{{end}} {{end}} {{if .User.Flag.Comics}}
Create a new chapter


{{end}} {{$PostLimit := 5}} {{if ge (len .Comic.Chapters) 20}} {{$PostLimit = 2}} {{end}} {{range .Comic.Chapters}}

Chapter {{.Order}}{{if .Title}} - {{.Title}}{{end}}

Pages: {{.PageCount}}

{{template "chapterPosts" wrap2 "UserInfo" "Posts" $.UserInfo (.NPages $PostLimit)}}
{{if and $.EditMode $.User.Flag.Comics}}
Edit
{{end}}
{{end}}
{{define "chapterPosts"}} {{$zindex := 10}} {{range .Posts}}
{{$zindex = add $zindex -1}} {{.Post.Cid}}
{{end}} {{end}} {{template "baseEnd"}}