完善
This commit is contained in:
parent
fbf5b64ddf
commit
0bd59e4172
|
@ -33,6 +33,7 @@ type IndexHandle struct {
|
||||||
postType []interface{}
|
postType []interface{}
|
||||||
status []interface{}
|
status []interface{}
|
||||||
header string
|
header string
|
||||||
|
paginationStep int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIndexHandle(ctx *gin.Context) *IndexHandle {
|
func NewIndexHandle(ctx *gin.Context) *IndexHandle {
|
||||||
|
@ -40,6 +41,7 @@ func NewIndexHandle(ctx *gin.Context) *IndexHandle {
|
||||||
c: ctx,
|
c: ctx,
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
paginationStep: 1,
|
||||||
titleL: models.Options["blogname"],
|
titleL: models.Options["blogname"],
|
||||||
titleR: models.Options["blogdescription"],
|
titleR: models.Options["blogdescription"],
|
||||||
where: models.SqlBuilder{
|
where: models.SqlBuilder{
|
||||||
|
@ -225,9 +227,6 @@ func index(c *gin.Context) {
|
||||||
archive, err := archives()
|
archive, err := archives()
|
||||||
categoryItems, err := categories()
|
categoryItems, err := categories()
|
||||||
q := c.Request.URL.Query().Encode()
|
q := c.Request.URL.Query().Encode()
|
||||||
if q != "" {
|
|
||||||
q = fmt.Sprintf("?%s", q)
|
|
||||||
}
|
|
||||||
c.HTML(http.StatusOK, "index.html", gin.H{
|
c.HTML(http.StatusOK, "index.html", gin.H{
|
||||||
"posts": postIds,
|
"posts": postIds,
|
||||||
"options": models.Options,
|
"options": models.Options,
|
||||||
|
@ -235,8 +234,7 @@ func index(c *gin.Context) {
|
||||||
"archives": archive,
|
"archives": archive,
|
||||||
"categories": categoryItems,
|
"categories": categoryItems,
|
||||||
"totalPage": h.getTotalPage(totalRaw),
|
"totalPage": h.getTotalPage(totalRaw),
|
||||||
"queryRaw": q,
|
"pagination": pagination(h.page, h.totalPage, h.paginationStep, c.Request.URL.Path, q),
|
||||||
"pagination": pagination(h.page, h.totalPage, 1, c.Request.URL.Path, q),
|
|
||||||
"search": h.search,
|
"search": h.search,
|
||||||
"header": h.header,
|
"header": h.header,
|
||||||
"title": h.getTitle(),
|
"title": h.getTitle(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user