mirror of
https://github.com/mindoc-org/mindoc.git
synced 2026-02-27 17:03:57 +08:00
1、新增标签页面
2、优化显示效果
This commit is contained in:
@@ -768,6 +768,9 @@ func (c *DocumentController) Export() {
|
||||
} else {
|
||||
bookResult = isReadable(identify, token, c)
|
||||
}
|
||||
if bookResult.PrivatelyOwned == 0 {
|
||||
//TODO 私有项目禁止导出
|
||||
}
|
||||
docs, err := models.NewDocument().FindListByBookId(bookResult.BookId)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -6,21 +6,27 @@ import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/lifei6671/mindoc/conf"
|
||||
"github.com/lifei6671/mindoc/utils"
|
||||
"math"
|
||||
)
|
||||
|
||||
type LabelController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
func (c *LabelController) Index() {
|
||||
c.Prepare()
|
||||
c.TplName = "label/index.tpl"
|
||||
func (c *LabelController) Prepare() {
|
||||
c.BaseController.Prepare()
|
||||
|
||||
//如果没有开启你们访问则跳转到登录
|
||||
if !c.EnableAnonymous && c.Member == nil {
|
||||
c.Redirect(beego.URLFor("AccountController.Login"),302)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//查看包含标签的文档列表.
|
||||
func (c *LabelController) Index() {
|
||||
c.Prepare()
|
||||
c.TplName = "label/index.tpl"
|
||||
|
||||
labelName := c.Ctx.Input.Param(":key")
|
||||
pageIndex,_ := c.GetInt("page",1)
|
||||
@@ -58,3 +64,30 @@ func (c *LabelController) Index() {
|
||||
|
||||
c.Data["LabelName"] = labelName
|
||||
}
|
||||
|
||||
func (c *LabelController) List() {
|
||||
c.Prepare()
|
||||
c.TplName = "label/list.tpl"
|
||||
|
||||
pageIndex,_ := c.GetInt("page",1)
|
||||
pageSize := 200
|
||||
|
||||
labels ,totalCount,err := models.NewLabel().FindToPager(pageIndex,pageSize)
|
||||
|
||||
if err != nil {
|
||||
c.ShowErrorPage(50001,err.Error())
|
||||
}
|
||||
if totalCount > 0 {
|
||||
html := utils.GetPagerHtml(c.Ctx.Request.RequestURI, pageIndex, pageSize, totalCount)
|
||||
|
||||
c.Data["PageHtml"] = html
|
||||
}else {
|
||||
c.Data["PageHtml"] = ""
|
||||
}
|
||||
c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize)))
|
||||
|
||||
c.Data["Labels"] = labels
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user