Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
0b3763cc
Commit
0b3763cc
authored
Oct 07, 2014
by
Jens Bissinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup pagination documentation. Refs #835.
parent
fa6cbc08
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
49 deletions
+59
-49
controller.go
utils/pagination/controller.go
+0
-49
doc.go
utils/pagination/doc.go
+59
-0
No files found.
utils/pagination/controller.go
View file @
0b3763cc
...
...
@@ -12,55 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage
//
// In your beego.Controller:
//
// package controllers
//
// import "github.com/astaxie/beego/utils/pagination"
//
// type PostsController struct {
// beego.Controller
// }
//
// func (this *PostsController) ListAllPosts() {
// // sets this.Data["paginator"] with the current offset (from the url query param)
// postsPerPage := 20
// paginator := pagination.SetPaginator(this, postsPerPage, CountPosts())
//
// // fetch the next 20 posts
// this.Data["posts"] = ListPostsByOffsetAndLimit(paginator.Offset(), postsPerPage)
// }
//
//
// In your view templates:
//
// {{if .paginator.HasPages}}
// <ul class="pagination pagination">
// {{if .paginator.HasPrev}}
// <li><a href="{{.paginator.PageLinkFirst}}">{{ i18n .Lang "paginator.first_page"}}</a></li>
// <li><a href="{{.paginator.PageLinkPrev}}">«</a></li>
// {{else}}
// <li class="disabled"><a>{{ i18n .Lang "paginator.first_page"}}</a></li>
// <li class="disabled"><a>«</a></li>
// {{end}}
// {{range $index, $page := .paginator.Pages}}
// <li{{if $.paginator.IsActive .}} class="active"{{end}}>
// <a href="{{$.paginator.PageLink $page}}">{{$page}}</a>
// </li>
// {{end}}
// {{if .paginator.HasNext}}
// <li><a href="{{.paginator.PageLinkNext}}">»</a></li>
// <li><a href="{{.paginator.PageLinkLast}}">{{ i18n .Lang "paginator.last_page"}}</a></li>
// {{else}}
// <li class="disabled"><a>»</a></li>
// <li class="disabled"><a>{{ i18n .Lang "paginator.last_page"}}</a></li>
// {{end}}
// </ul>
// {{end}}
//
// See also http://beego.me/docs/mvc/view/page.md
package
pagination
import
(
...
...
utils/pagination/doc.go
0 → 100644
View file @
0b3763cc
/*
The pagination package provides utilities to setup a paginator within the
context of a http request.
Usage
In your beego.Controller:
package controllers
import "github.com/astaxie/beego/utils/pagination"
type PostsController struct {
beego.Controller
}
func (this *PostsController) ListAllPosts() {
// sets this.Data["paginator"] with the current offset (from the url query param)
postsPerPage := 20
paginator := pagination.SetPaginator(this, postsPerPage, CountPosts())
// fetch the next 20 posts
this.Data["posts"] = ListPostsByOffsetAndLimit(paginator.Offset(), postsPerPage)
}
In your view templates:
{{if .paginator.HasPages}}
<ul class="pagination pagination">
{{if .paginator.HasPrev}}
<li><a href="{{.paginator.PageLinkFirst}}">{{ i18n .Lang "paginator.first_page"}}</a></li>
<li><a href="{{.paginator.PageLinkPrev}}">«</a></li>
{{else}}
<li class="disabled"><a>{{ i18n .Lang "paginator.first_page"}}</a></li>
<li class="disabled"><a>«</a></li>
{{end}}
{{range $index, $page := .paginator.Pages}}
<li{{if $.paginator.IsActive .}} class="active"{{end}}>
<a href="{{$.paginator.PageLink $page}}">{{$page}}</a>
</li>
{{end}}
{{if .paginator.HasNext}}
<li><a href="{{.paginator.PageLinkNext}}">»</a></li>
<li><a href="{{.paginator.PageLinkLast}}">{{ i18n .Lang "paginator.last_page"}}</a></li>
{{else}}
<li class="disabled"><a>»</a></li>
<li class="disabled"><a>{{ i18n .Lang "paginator.last_page"}}</a></li>
{{end}}
</ul>
{{end}}
See also
http://beego.me/docs/mvc/view/page.md
*/
package
pagination
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment