Skip to content

Commit f8ad60a

Browse files
committed
README documentation.
1 parent 077a4ba commit f8ad60a

File tree

2 files changed

+86
-11
lines changed

2 files changed

+86
-11
lines changed

README.md

Lines changed: 85 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,104 @@
1-
# Jquery::Bootstrap::Pagination
1+
# jQuery Bootstrap Pagination
22

3-
TODO: Write a gem description
3+
A simple, full-featured, pagination system for [jQuery](http://jquery.com/) that outputs [Twitter Bootstrap](http://twitter.github.com/bootstrap/) marked up pagination links. Of course, there's no reason you need to use this with Bootstrap, the HTML output is very clean.
44

55
## Installation
66

7+
The library can be used in CoffeeScript, JavaScript, and Rails applications very easily.
8+
9+
### Standalone
10+
11+
#### CoffeeScript
12+
13+
Use the `src/jquery-bootstrap-pagination.coffee` file.
14+
15+
#### JavaScript
16+
17+
Use the `vendor/assets/javascripts/jquery-bootstrap-pagination.js` file. This file is auto generated from the CoffeeScript file.
18+
19+
### Rails 3.x
20+
721
Add this line to your application's Gemfile:
822

9-
gem 'jquery-bootstrap-pagination'
23+
``` ruby
24+
gem 'jquery-bootstrap-pagination'
25+
```
1026

1127
And then execute:
1228

13-
$ bundle
29+
```
30+
$ bundle
31+
```
1432

15-
Or install it yourself as:
33+
Add it to your `application.js` file:
1634

17-
$ gem install jquery-bootstrap-pagination
35+
``` javascript
36+
//= require jquery-bootstrap-pagination
37+
```
1838

1939
## Usage
2040

21-
TODO: Write usage instructions here
41+
### CoffeeScript
42+
``` coffeescript
43+
# Basic usage:
44+
$("#my-pagination-section").pagination()
45+
46+
# With options:
47+
$("#my-pagination-section").pagination
48+
total_pages: 10
49+
current_page: 2
50+
callback: (event, page) ->
51+
alert("Page #{page} was clicked!")
52+
53+
# Retrieve the underlying PaginationView:
54+
$("#my-pagination-section").data("paginationView")
55+
```
56+
57+
### JavaScript:
58+
``` javascript
59+
// Basic usage:
60+
$("#my-pagination-section").pagination();
61+
62+
// With options:
63+
$("#my-pagination-section").pagination({
64+
total_pages: 10,
65+
current_page: 2,
66+
callback: function(event, page) {
67+
return alert("Page " + page + " was clicked!");
68+
}
69+
});
70+
71+
// Retrieve the underlying PaginationView:
72+
$("#my-pagination-section").data("paginationView");
73+
```
74+
75+
### Options and Defaults:
76+
``` coffeescript
77+
# what is the current page:
78+
current_page: 1
79+
# how many pages are there total:
80+
total_pages: 1
81+
# change text of the 'next' link,
82+
# set to false for no next link:
83+
next: ">"
84+
# change text of the 'previous' link,
85+
# set to false for no previous link:
86+
prev: "<"
87+
# change text of the 'first' link,
88+
# set to false for no first link:
89+
first: false
90+
# change text of the 'last' link,
91+
# set to false for no last link:
92+
last: false
93+
# how many links before truncation happens:
94+
display_max: 8
95+
```
2296

2397
## Contributing
2498

2599
1. Fork it
26100
2. Create your feature branch (`git checkout -b my-new-feature`)
27-
3. Commit your changes (`git commit -am 'Add some feature'`)
28-
4. Push to the branch (`git push origin my-new-feature`)
29-
5. Create new Pull Request
101+
3. Write/Run tests (`bundle exec rake`)
102+
4. Commit your changes (`git commit -am 'Add some feature'`)
103+
5. Push to the branch (`git push origin my-new-feature`)
104+
6. Create new Pull Request

jquery-bootstrap-pagination.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
1010
gem.email = ["mark@markbates.com"]
1111
gem.description = %q{A simple and clean pagination implementation for jQuery and Twitter Bootstrap.}
1212
gem.summary = %q{A simple and clean pagination implementation for jQuery and Twitter Bootstrap.}
13-
gem.homepage = ""
13+
gem.homepage = "http://github.com/markbates/jquery-bootstrap-pagination"
1414

1515
gem.files = `git ls-files`.split($/)
1616
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }

0 commit comments

Comments
 (0)