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

Hide custom terms from resource forms #359

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Conversation

laritakr
Copy link
Contributor

Story

This is a partial fix for scientist-softserv/hykuup_knapsack#240 and is tied in with a change in hyrax to support display: false

Expected Behavior Before Changes

IiifPrint custom terms always appear on resource forms.

Expected Behavior After Changes

IiifPrint custom terms can be hidden via yaml display: false in the form definition.

Screenshots / Video

Screenshots

Before

Screenshot 2024-06-20 at 2 31 04 PM

After

Screenshot 2024-06-20 at 2 29 46 PM

Notes

@@ -4,13 +4,19 @@ attributes:
multiple: false
index_keys:
- "is_child_bsi"
form:
Copy link
Contributor

@ShanaLMoore ShanaLMoore Jun 20, 2024

Choose a reason for hiding this comment

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

I wonder if adding this back will set is_child to false again, instead of nil. cc @laritakr

we need is_child to be true or nil. The catalog query filters out anything that's nil.

if it must be false, I suppose we could update the query but I wonder why it was never set to false from the original implementation.

Copy link
Contributor

@ShanaLMoore ShanaLMoore Jun 20, 2024

Choose a reason for hiding this comment

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

Also ideally we won't update the query because existing applications would need to set their nils to false which may require their data to be reindexed. Unless the query can filter out both 🤔

Copy link
Contributor

@ShanaLMoore ShanaLMoore Jun 20, 2024

Choose a reason for hiding this comment

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

perhaps something like the following will work (untested). I'm not sure how to write a filter query for NOT is_child:true

def show_parents_only(solr_parameters)
  query = if blacklight_params["include_child_works"] == 'true'
            IiifPrint.solr_construct_query(is_child_bsi: 'true')
          else
            "-_query_:\"{!field f=is_child_bsi}true\"" 
          end
  solr_parameters[:fq] += [query]
end

Copy link
Contributor Author

@laritakr laritakr Jun 20, 2024

Choose a reason for hiding this comment

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

The term is not present on the parent, so it is nil.
On the child, it is true as expected.
The child works are once again hidden from the catalog search.

Screenshot 2024-06-20 at 3 14 17 PM

Screenshot 2024-06-20 at 3 14 45 PM

Screenshot 2024-06-20 at 3 15 14 PM
be6)

@laritakr laritakr merged commit 9f68cc8 into main Jun 20, 2024
9 of 10 checks passed
@laritakr laritakr deleted the hide-terms-from-resource-forms branch June 20, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants