Added pager.
This commit is contained in:
parent
63f43e568c
commit
1f258ea17e
2 changed files with 63 additions and 0 deletions
|
|
@ -5,10 +5,15 @@ import (
|
|||
"net/http"
|
||||
|
||||
"goweb/msg"
|
||||
"goweb/pager"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultItemsPerPage = 20
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
AppName string
|
||||
Title string
|
||||
|
|
@ -25,6 +30,7 @@ type Page struct {
|
|||
Description string
|
||||
Keywords []string
|
||||
}
|
||||
Pager pager.Pager
|
||||
}
|
||||
|
||||
func NewPage(c echo.Context) Page {
|
||||
|
|
@ -33,6 +39,7 @@ func NewPage(c echo.Context) Page {
|
|||
Reverse: c.Echo().Reverse,
|
||||
Path: c.Request().URL.Path,
|
||||
StatusCode: http.StatusOK,
|
||||
Pager: pager.NewPager(c, DefaultItemsPerPage),
|
||||
}
|
||||
|
||||
p.IsHome = p.Path == "/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue