实现markdown编辑器

This commit is contained in:
Minho
2017-04-26 18:17:38 +08:00
parent f91ad51e3f
commit 8c85227c30
614 changed files with 80785 additions and 70030 deletions

View File

@@ -1,5 +1,10 @@
package controllers
import (
"github.com/lifei6671/godoc/models"
"github.com/astaxie/beego/logs"
)
type DocumentController struct {
BaseController
}
@@ -11,3 +16,22 @@ func (p *DocumentController) Index() {
func (p *DocumentController) Read() {
p.TplName = "document/kancloud.tpl"
}
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"
}
}