-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(pagination): Add force-ellipses and boundary-link-numbers options #3565
Conversation
The main concern I have with this as a feature is that this increases the complexity of the pagination exponentially, since now we have a link between the start and end that has to be maintained in addition to the features, which should have been split into two PRs. In addition, I see a commit by @wtc-dstone here - it is bad form to open a PR with someone else's commits unless the person gave explicit approval, for license reasons. |
Ok. Where do you see the complexity being the issue? In the added options (and documentation) that the user sees or the underlying code or both? What would you like to see? You didn't really give any action points. Also I don't know much about licensing issues. I was trying not to just steal the code he wrote without giving him credit. What should I have done/how should I fix that? If I were to clean it up I think I would just keep the Let me know how you would like to see this move forward. I'd be willing to work on it more. Thanks for the feedback. |
Re: Licensing - I understand the intent is good, but if the person didn't file the PR, there is always the chance that the person does not wish to give permission for the code to get merged back into the main project. That person owns the code he/she wrote, so the person would have every right. The complexity lies in changing the data structure at heart to not be just an array, but a doubly linked list that loops at the ends, like a carousel. Given the complexity that results and given that this is a far departure from a normal pagination control UXwise, the rotate feature should not be present in the control in this project in my opinion. As a consequence, the action items should be to
In the future, please do separate PRs for separate features - it makes it much easier to revert painlessly if it is decided that a change needs to be reverted. |
Hey I think I'm a little confused. I'm struggling trying to explain it concisely. Hopefully some of this makes sense and you are able to clear it up. Maybe in my confusion about this, I'm proving the complexity of this feature haha. I didn't think it would take this much thought. Here are my two main thoughts at trying to explain my confusion: What does "remove the rotate feature" mean?Maybe we have different ideas of what "rotate" means and what removing it looks like. If you want to see all the options that are available based on where the PR currently is at check out: http://plnkr.co/edit/G7phcuFXSgY1vRPnMIo8?p=preview Rotate could mean:
If the PR was merged as is it would have options to enable the functionality of 4 and 5. Before it only had 4. Idk if 6 would ever be wanted. What does removing the "doubly linked list that loops at the ends" and its complexity look like?I don't think I added any new data structures. The only code this PR modified was the Originally it looked like this: (from https://github.com/angular-ui/bootstrap/blob/master/src/pagination/pagination.js#L161-L172) // Add links to move between page sets
if ( isMaxSized && ! rotate ) {
if ( startPage > 1 ) {
var previousPageSet = makePage(startPage - 1, '...', false);
pages.unshift(previousPageSet);
}
if ( endPage < totalPages ) {
var nextPageSet = makePage(endPage + 1, '...', false);
pages.push(nextPageSet);
}
}
Every object added to
I'm not sure where the "doubly linked list that loops at the ends, like a carousel is". Are you talking about a data structure or a UX concept? The code in this PR just adds a couple more additional links to move between page sets (first and last page numbers and ellipses in more cases). These new links are just links that change Last thought about UXIf we enable first and last links containing page numbers there needs to be something separating them from the rest of the numbers when they are not sequential. Currently in the PR Now I was looking at other sites like StackOverflow for ideas. |
Ah, my apologies, I was completely confused - I thought it was supporting moving from [insert last page] to page 1. I am ok with what you are suggesting. Still, I believe this should be split off into two separate PRs, and should not have the commit pollution. |
Alright. Glad we are on the same page. I'll work on that. I might not get back to it immediately. |
Actually I did already kinda split them. This is dependent on #3564 which adds the The old commit by @wtc-dstone still needs to be dealt with though in both of them. Should I just do a rebase to squash the first 2 commits? |
History needs to be fixed - there should not be a merge commit. |
I did a rebase instead of a merge. I still don't know what to do with the commit by @wtc-dstone. There's this tool to change author info but that seems exactly like stealing code. I could squash that code into one of my commits but that seems the same. His code was in #3035 so it seems like he intended to allow this commit to be part of this project. I think I need direction from you since this is a licensing issue. |
Looks like you are correct after reading the comments through the issue & PR. I am fine with his/her commit being there. I need to take another look at this PR. |
This needs rebasing. |
Done. |
Can you squash the last 3 commits into 1? I will look into getting this in when that is done - this will make rebasing on top of |
…rs to show first and last page
Done. |
Setting
force-ellipses
totrue
: When we have more pages than can be shown androtate
istrue
, ellipses will be shown (without it they are only shown whenrotate
isfalse
. Example:Previous, ..., 4, 5, 6, ..., Next
Setting
boundary-link-numbers
totrue
: When we have more pages than can be shown, the first and last page numbers will always be shown. Example:Previous, 1, ..., 4, 5, 6, ..., 9, Next
Cleans up and builds off of #3564 which only had
force-ellipses
. (PR now closed)Based off #3035 and makes ellipses for rotating an opt-in feature
Addresses issue #2924 (wanting ellipses when rotating)
Addresses issue #3064 (wanting first and last page numbers)