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

Only show search context controls if the current context matches the … #2297

Merged
merged 8 commits into from
Sep 30, 2020

Conversation

cbeer
Copy link
Member

@cbeer cbeer commented Jun 4, 2020

…current document

Maybe helps address or obscure the problems from #2295?

@@ -68,7 +68,7 @@ def link_to_next_document(next_document)
# session_tracking_params(SolrDocument.new(id: 123), 7)
# => { data: { :'context-href' => '/catalog/123/track?counter=7&search_id=999' } }
def session_tracking_params document, counter
path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id))
path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id), document_id: document.id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a safe navigation operator you get a id not defined on nil error when you click on the first result.

Suggested change
path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id), document_id: document.id)
path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id), document_id: document&.id)

@cdmo
Copy link
Member

cdmo commented Aug 12, 2020

I am on 7.5.1 for my purposes and we have some local differences in our placement of where we render previous_next_doc, but so far in testing things out locally this PR is working!

@cdmo
Copy link
Member

cdmo commented Sep 1, 2020

Just rebased and then added a rubocop fix todo update here.

@cdmo
Copy link
Member

cdmo commented Sep 8, 2020

I took the liberty of fleshing this PR out some more, hope that's okay. I wasn't sure of a couple of thing: 1) if the url_helper_behavior needed additional testing and if views/catalog/_show.html.erb_spec.rb:1 needed a corresponding view spec - I didn't see one at all for this partial.

@cdmo cdmo marked this pull request as ready for review September 8, 2020 15:18
@mejackreed mejackreed merged commit 9701904 into master Sep 30, 2020
@mejackreed mejackreed deleted the search-context-idea branch September 30, 2020 19:42
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.

None yet

3 participants