Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict pagination links to groups of 10 #23

Merged
merged 1 commit into from
Sep 19, 2016

Conversation

darinwilson
Copy link
Contributor

@darinwilson darinwilson commented Sep 19, 2016

Fixes #19 by adding Google-style pagination links: the number of pagination links is restricted by a distance setting, with the current page placed (roughly) in the center.

screen shot 2016-09-19 at 6 28 19 am

The distance setting can be configured in the controller, but the pagination template falls back to a default value of 5 if the value is not set. This is to preserve backward compatibility with pages generated by older versions of torch.

end
defp end_page(current_page, _total, distance) do
current_page + distance - 1
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic was mostly cribbed from scrivener_html

@danielberkompas danielberkompas merged commit 25e9da4 into master Sep 19, 2016
@danielberkompas danielberkompas deleted the pagination-improvements branch September 19, 2016 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants