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

Keep sort when switching page #2013

Merged
merged 1 commit into from
Jun 22, 2017
Merged

Keep sort when switching page #2013

merged 1 commit into from
Jun 22, 2017

Conversation

iszla
Copy link
Contributor

@iszla iszla commented Jun 19, 2017

Keep chosen sort when browser through pages with pagination. I put the sort query parameter first, as that is how it appears in the URL when first selecting a sort type.
Fixes #1980

@bkcsoft
Copy link
Member

bkcsoft commented Jun 19, 2017

It is tested on other paginated pages that doesn't have sort?

If so LGTM for now, in the future pagination should url.Parse and just retain the other variables 🙂

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jun 19, 2017
@iszla
Copy link
Contributor Author

iszla commented Jun 19, 2017

As far as I can see, it is only used where there is also sorting available. /admin/notices for example does not have sort, but does not use this template

@lunny lunny added this to the 1.2.0 milestone Jun 20, 2017
@lunny lunny added the type/bug label Jun 20, 2017
@ethantkoenig
Copy link
Member

@iszla It looks like templates/user/notification/notification.tmpl (GET /notifications) uses templates/base/paginate.tmpl, but does not have sorting.

@lunny
Copy link
Member

lunny commented Jun 20, 2017

@ethantkoenig but that will not effect notification. Only a non-use query stirng

@ethantkoenig
Copy link
Member

@lunny Will it cause an error when the template engine tries to evaluate {{$.SortType}}? (Sorry, I'm not fluent in go templates)

@lunny
Copy link
Member

lunny commented Jun 20, 2017

@ethantkoenig no. it will be a empty string.

@bkcsoft
Copy link
Member

bkcsoft commented Jun 20, 2017

@iszla could you test if GET /notifications crashes? (should not need anything in DB, since template should fail to compile if anything)

@iszla
Copy link
Contributor Author

iszla commented Jun 20, 2017

Sure thing, I'll test as soon as I get home

@iszla
Copy link
Contributor Author

iszla commented Jun 20, 2017

It works fine on /notifications as well. With and without pagination. Of course, when switching between pages it adds the sort query parameter but it is empty, like with the tab and q query parameters.

Example
http://localhost:3000/notifications?sort=&page=1&q=&tab=

@ethantkoenig
Copy link
Member

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 21, 2017
@lunny lunny merged commit 826c606 into go-gitea:master Jun 22, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The pagination of explore page does not honor the sort attribute.
5 participants