-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Admin tables order - sorting [#2931] #3148
Admin tables order - sorting [#2931] #3148
Conversation
I think it's pretty much it. Let me know what you think so far :) (Those failing tests are not related to my changes, though) |
We were assuming the translation and the column name were related.
It's OK ot use single quotes inside a string with double quotes in order to avoid escape characters.
The string inside `params[:direction]` should already use lowercase characters.
Using a simple ternary operator is usually fine; however, code combining two ternary operator is a bit hard to follow.
Using a hash instead of an array of hashes makes accessing its keys and values much easier.
Just the way is usually done in the rest of the code.
@matisnape Thank you very much for this pull request! 🏆 It looks like there are conflicts with our current So we've opened a new branch rebasing your changes against current In order to update this pull request, run the following commands:
Then we can merge it into master 😄. |
@javierm I would like to continue working on adding sorting to other tables and open another PR after this one is merged. Do you have any suggestions on how to make the sorting more reusable? |
@matisnape That would be awesome! Thank you so much 🙏! In order to make the code more reusable, you can try one of these approaches:
Once we do similar tasks in a couple of places, it's easier to find ways to reuse the code 😄. |
You mean new table in database? |
I mean another table ( |
@javierm done! :) |
@matisnape Thanks a lot! 🎉 |
I'll start working on adding sorting in other places :) |
References
Issue: Admin tables order #2931
Objectives
Visual Changes
Notes
This is my first ever external commitment and I don't have commercial experience, so I figure there is a lot to refactor. I'd be happy to do that after code review :) Just point everything I could improve and I'll do my best :) I'd also would like to implement sorting for other tables as well so I'd appreciate any guidance towards making this more reusable.