-
Notifications
You must be signed in to change notification settings - Fork 256
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
Copy SearchContextComponent to ServerItemPaginationComponent to ease BL8 upgrade path #3421
Copy SearchContextComponent to ServerItemPaginationComponent to ease BL8 upgrade path #3421
Conversation
…BL8 upgrade path Closes projectblacklight#3313
f1195c2
to
4d5d149
Compare
end | ||
|
||
def render? | ||
@search_context.present? && (@search_context[:prev] || @search_context[:next]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blacklight 8 has this as:
@search_context.present? && (@search_context[:prev] || @search_context[:next]) | |
@search_context.present? && (@search_context[:prev] || @search_context[:next] || total.positive?) && (@search_session['document_id'] == @current_document_id) |
Should this match, or is there a reason this is different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that version and it wasn't compatible with Blacklight 7.
My hope with this PR is that we will be able to add a component to replace our custom pagination partial that will work with both Blacklight 7 and Blacklight 8 without significant revisions when upgrading between versions.
I think I follow what's going on, but can you briefly explain how this eases BL8 upgrade path? Also, there are no tests here -- Can you explain your attitude toward tests here? Perhaps we don't need tests, because existing tests cover all necessary things to test, that existing tests continue to be green under this refactor is sufficient? I'm not sure. |
My sense was that the existing tests were sufficient for the refactor, but I can try to write some new ones or pull from main for the components. |
Oh don't add new tests on my account, I was just confirming it was intentional not to include any,that's fine with me! |
- Test components Co-authored-by: Jane Sandberg <[email protected]>
2ae7356
to
7d0ec28
Compare
Sorry, realized I didn't explicitly respond to this part @jrochkind. We have a custom partial for our Also, having accurate deprecation statements is helpful! But it's hard when they say to use a thing you cannot actually use! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @maxkadel !
|
||
module Blacklight | ||
module SearchContext | ||
class ServerItemPaginationComponent < Blacklight::SearchContextComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach of inheriting from the Blacklight 7 component, and providing an interface that is compatible with the Blacklight 8 component!
@@ -106,7 +106,7 @@ def item_page_entry_info | |||
total: number_with_delimiter(search_session['total']), | |||
count: search_session['total'].to_i).html_safe | |||
end | |||
deprecation_deprecate item_page_entry_info: 'Use Blacklight::SearchContextComponent methods instead' | |||
deprecation_deprecate item_page_entry_info: 'Use Blacklight::SearchContext::ServerItemPaginationComponent methods instead' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Closes #3313