diff --git a/conf/enumerate.go b/conf/enumerate.go index 96c3a9c9..4b2e2049 100644 --- a/conf/enumerate.go +++ b/conf/enumerate.go @@ -19,7 +19,7 @@ const RegexpEmail = `^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$` const RegexpAccount = `^[a-zA-Z][a-zA-z0-9\.]{2,50}$` // PageSize 默认分页条数. -const PageSize = 15 +const PageSize = 5 // 用户权限 const ( diff --git a/controllers/document.go b/controllers/document.go index 2760bacd..e4728bc3 100644 --- a/controllers/document.go +++ b/controllers/document.go @@ -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 { diff --git a/controllers/label.go b/controllers/label.go index c2fe653f..ca36fe66 100644 --- a/controllers/label.go +++ b/controllers/label.go @@ -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 +} + + + diff --git a/routers/router.go b/routers/router.go index 880ec872..e94d4261 100644 --- a/routers/router.go +++ b/routers/router.go @@ -85,5 +85,6 @@ func init() { beego.Router("/search",&controllers.SearchController{},"get:Index") beego.Router("/tag/:key", &controllers.LabelController{},"get:Index") + beego.Router("/tags", &controllers.LabelController{},"get:List") } diff --git a/static/css/main.css b/static/css/main.css index 0d24e3ac..aa086a95 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -249,13 +249,24 @@ textarea{ height: 231px; position: relative; } +.manual-list .list-item .manual-item-standard>dt>a { + display: block; + position: relative; + width: 100%; +} +.manual-list .list-item .manual-item-standard>dt>a .image{ + position: relative; + /*display: none;*/ +} .manual-list .list-item .manual-item-standard .cover { - border: 1px solid #999999; + border: none; width: 171px; position: relative; display: inline-block; height: 229px; - background-color: #eee + background-color: #eee; + border-radius: 2px; + box-shadow: 0 1px 3px 0 #d4d4d5, 0 0 0 1px #d4d4d5; } .manual-list .list-item .manual-item-standard .b-cover:hover { border-color: #4db559; @@ -562,19 +573,27 @@ textarea{ .pagination-container { margin: 5px auto; - text-align: center !important; display: block !important; } +.pagination-container .pagination{ + box-shadow: 0 1px 2px 0 #e3e3e0; +} .pagination-container .pagination>li>a,.pagination-container .pagination>li>span{ - padding: 4px 9px !important; + padding: 8px 16px !important; } .pagination-container .pagination>li>a,.pagination-container .pagination>li>span{ - color: #333; + color: #272727; } .pagination-container .pagination>.active>a{ - color: #fff; + /*color: #fff;*/ + background-color: #f3f3f3; + border: 1px solid #e3e3e0; } - /**************网站底部样式*************************/ +.pagination-container .pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover, .pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover{ + color: #272727; +} + +/**************网站底部样式*************************/ .footer{ color: #777; padding: 30px 0; diff --git a/utils/pager.go b/utils/pager.go index 1dcf7349..1a9ec51e 100644 --- a/utils/pager.go +++ b/utils/pager.go @@ -25,6 +25,7 @@ type PageOptions struct { NextPageText string //下一页文字 默认"下一页" EnableFirstLastLink bool //是否启用首尾连接 默认false 建议开启 EnablePreNexLink bool //是否启用上一页,下一页连接 默认false 建议开启 + TotalPages int } /** @@ -99,6 +100,7 @@ func GetPagerHtml(requestURI string,pageIndex, pageSize,totalCount int) (html.HT PageSize: pageSize, EnableFirstLastLink : true, ParamName : "page", + TotalPages:int(math.Ceil(float64(totalCount) / float64(pageSize))), } totalPages := int(math.Ceil(float64(totalCount) / float64(pageSize))) @@ -249,9 +251,13 @@ func fun1(po *PageOptions, totalpages int) string { */ func getHeader(po *PageOptions, totalpages int) string { var rs string = "" return rs diff --git a/views/home/index.tpl b/views/home/index.tpl index e1025817..cdff6e28 100644 --- a/views/home/index.tpl +++ b/views/home/index.tpl @@ -25,7 +25,7 @@ {{template "widgets/header.tpl" .}}
- {{if gt (.Labels|len) 0}} + {{if gt (.Labels|len) 1000000}}
热门标签: diff --git a/views/label/index.tpl b/views/label/index.tpl index f7ecbdd6..b3f6ec1e 100644 --- a/views/label/index.tpl +++ b/views/label/index.tpl @@ -52,7 +52,7 @@
-
diff --git a/views/label/list.tpl b/views/label/list.tpl new file mode 100644 index 00000000..057d54c4 --- /dev/null +++ b/views/label/list.tpl @@ -0,0 +1,54 @@ + + + + + + + + 标签列表 - Powered by MinDoc + + + + + + + + + + + + +
+ {{template "widgets/header.tpl" .}} +
+
+ 显示标签列表 +
+
+ {{if gt (.Labels|len) 0}} +
+ + {{range $index,$item := .Labels}} + {{$item.LabelName}}{{$item.BookNumber}} + {{end}} + +
+ + {{end}} + +
+
+ {{template "widgets/footer.tpl" .}} +
+ + + + \ No newline at end of file diff --git a/views/manager/attach_list.tpl b/views/manager/attach_list.tpl index b585976d..000c5c89 100644 --- a/views/manager/attach_list.tpl +++ b/views/manager/attach_list.tpl @@ -72,7 +72,7 @@ {{end}} -
diff --git a/views/widgets/header.tpl b/views/widgets/header.tpl index 8082d351..1cc6be77 100644 --- a/views/widgets/header.tpl +++ b/views/widgets/header.tpl @@ -8,14 +8,26 @@ {{.SITE_NAME}} {{end}} - + + +