mindoc/controllers/document.go

37 lines
702 B
Go
Raw Normal View History

2017-04-20 18:19:32 +08:00
package controllers
2017-04-26 18:17:38 +08:00
import (
"github.com/lifei6671/godoc/models"
"github.com/astaxie/beego/logs"
)
2017-04-20 18:19:32 +08:00
type DocumentController struct {
BaseController
}
func (p *DocumentController) Index() {
p.TplName = "document/index.tpl"
}
func (p *DocumentController) Read() {
p.TplName = "document/kancloud.tpl"
}
2017-04-26 18:17:38 +08:00
func (c *DocumentController) Edit() {
c.Prepare()
identify := c.Ctx.Input.Param(":key")
book,err := models.NewBook().FindByFieldFirst("identify",identify)
if err != nil {
logs.Error("DocumentController.Edit => ",err)
c.Abort("500")
}
if book.Editor == "markdown" {
c.TplName = "document/markdown_edit_template.tpl"
}else{
c.TplName = "document/html_edit_template.tpl"
}
}