修复首页不显示分页的BUG

pull/51/head
Minho 2017-05-31 10:15:04 +08:00
parent 80c7f25223
commit 6686de168c
4 changed files with 25 additions and 3 deletions

View File

@ -53,10 +53,10 @@ notifications:
deploy:
- provider: GitHub
name: production
auth_token:
secure:
secure: "Qkhxloft5lBKti7O+vVS+Vrxh7CBAUVhlfdZ9ptBXjFtjt6jHXnaBA2uv2OYbISB"
draft: false
prerelease: false
artifact: godoc_windows_%GOARCH%.7z
on:
branch: master

View File

@ -4,6 +4,7 @@ import (
"github.com/astaxie/beego"
"github.com/lifei6671/godoc/models"
"github.com/lifei6671/godoc/utils"
"math"
)
type HomeController struct {
@ -38,6 +39,7 @@ func (c *HomeController) Index() {
}else {
c.Data["PageHtml"] = ""
}
c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize)))
c.Data["Lists"] = books

View File

@ -509,7 +509,21 @@ textarea{
word-wrap: break-word; /* Help out IE10+ with class names */
}
/**************网站底部样式*************************/
.pagination-container {
margin: 5px auto;
text-align: center !important;
display: block !important;
}
.pagination-container .pagination>li>a,.pagination-container .pagination>li>span{
padding: 4px 9px !important;
}
.pagination-container .pagination>li>a,.pagination-container .pagination>li>span{
color: #333;
}
.pagination-container .pagination>.active>a{
color: #fff;
}
/**************网站底部样式*************************/
.footer{
color: #777;
padding: 30px 0;

View File

@ -49,6 +49,12 @@
{{end}}
<div class="clearfix"></div>
</div>
<nav class="pagination-container">
{{if gt .TotalPages 1}}
{{.PageHtml}}
{{end}}
<div class="clearfix"></div>
</nav>
</div>
</div>
{{template "widgets/footer.tpl" .}}