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

Redesign Paginator #3

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

mehrdadkhoddami
Copy link

  • Reformat generateButton to get label
  • define Offset for range
  • Refactor generateRange to have better algorithm and consider Offsets
  • Refactor generateKeyboard to work with this new solution
  • Add optional setMaxPageBasedOnLabels to generate max_page according to labels

- Reformat generateButton to get label
- define Offset for range
- Refactor generateRange to have better algorithm and consider Offsets
- Refactor generateKeyboard to work with this new solution
- Add optional setMaxPageBasedOnLabels to generate max_page according to labels
@noplanman
Copy link
Member

Hi, thanks for your contribution.

Please make sure you adhere to the PSR-2 guidelines, in your case 4 spaces instead of tabs.

Then I can take a look and see what your actual addition is 👍

@mehrdadkhoddami
Copy link
Author

Hi,
Sure

Notes with thanks.
I reformat file with PSR-2 . But I didn't change tests.

@noplanman
Copy link
Member

I can have a look at the tests and see what's up.

Before that though, could you please explain in more depth what this PR does exactly?
Best show some examples of what is new / changed.

Thanks!

@mehrdadkhoddami
Copy link
Author

Sure.

  • First of all, I add a range for selected page. e.g if we have 9 pages, selected page is 6 & range for it was set 1, in the pagination, user can see 5 & 7 (default is 1 as range).
    img
    In this case, I rewrite generateRange() method.

  • Also, User can pass only labels which he/she wants. (Same as before)
    but now user can call setMaxPageBasedOnLabels() method to set $max_buttons according to passed labels & and range of selected page.

  • I changed generateButton() to get label of button.

  • I added two conditions to setSelectedPage() :

  1. If user requests negative or zero page number, method sets it to page Customised pagination buttons and styles #1 automatically.
  2. If user requests page which is greater than total number of pages, method sets it to total number of pages automatically.
  • Finally I refactor generateKeyboard() based on these changes.

Thank you.

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