-
Notifications
You must be signed in to change notification settings - Fork 0
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
Show box and folder metadata on search results page. #2822
Conversation
Looks good. Can we find a way to do this only on Collection search result pages, not every search result? (Or maybe you already have one?). Not totally sure how to appraoch this, may need to figure out how to change architecture to support. Also make sure the line doesn't show up if there is no box/folder values (including just empty strings). |
This only shows on Collection search results, since the subclass is only used in |
Will include tests that prove the above assertions! |
Awesome! |
Added tests. |
Nicely done. I don't LOVE sub-classing WorkComponent, as sub-classes can be fragile ("prefer composition over inheritance"). In an ideal world, I'd like to add this to WorkComponent, as a configuration option in initializer on WorkComponent ( I think that could possibly result in ultimately simpler code... this is a bit spaghetti? But that might also be just spagetti too. I guess we have tests that should catch us if we break? So maybe we'll just go with this for now! You did do a great job of figuring out how to fit this into existing architecture, which wasn't too bad, so I guess we should count our blessings! Approved if you feel good with moving forward even after these comments! |
That's a good idea and I don't believe it's a huge change. Hang on, let me see if I can do that... |
Sorry - that approach turns out to be tricky because If I can figure out a way around this, I might refactor this later. For now I'm moving forward. |
This PR subclasses
WorkComponent
(which is itself a subclass ofBaseComponent
) with a new subclass:SearchWithinCollectionWorkComponent
.CollectionShowController
.box_and_folder
box_and_folder
returnsnil
unless the model is a Work and hasdepartment
set to 'Archives'.box_and_folder
returns a string listing the box and folder.