Closed hachacha closed 5 years ago
I think it could be easily done. So at the end of the search view we can call something like:
articles = call_hook(‘search’, articles)
The archive plugin registers itself for the ‘search’ hook so it gets called and has the existing list of articles passed in, can filter them further and pass them back...
Thoughts?
OK - what, if any, changes does this then mean for https://github.com/BirkbeckCTP/janeway/pull/918 ?
I think I see how this would work...
This method should be registered in the hook_registry
in plugin_settings
and set up in the hooks.py file to capture the article_list
from the request and then filter and send back to search?
This would also allow for a user to toggle on or off if they want the archive plugin to interact with search results and only show the latest published versions, right?
I haven't looked at the code revisions in the PR on janeway but I don't think that anything major would need to change in there.
also sorry i closed this by accident :<
This would also allow for a user to toggle on or off if they want the archive plugin to interact with search results and only show the latest published versions, right?
Exactly!
I have created this so it's now a plugin setting and responds to a hook in the ethos_theme filter_search
. it modifies the context containing the articles querystring to exclude older versions. you can toggle this feature on and off in the plugin settings manager.
The hook can be added to the search template here: https://github.com/dSHARP-CMU/ethos_theme/tree/add_filter_search_hook
looks good to me! Ready to merge?
This SHOULD be a temporary fix until https://github.com/BirkbeckCTP/janeway/pull/918 can be merged and then will link up https://github.com/dSHARP-CMU/archive_plugin/blob/49d01433cbdc29adc02b7b9842c2d1751ad05083/logic.py#L80 somehow to capture the search results and display only the latest versions of articles.
Closes https://github.com/dSHARP-CMU/cmesh-dev/issues/303
Closes https://github.com/dSHARP-CMU/cmesh-dev/issues/139
Closes https://github.com/dSHARP-CMU/cmesh-dev/issues/152
Closes https://github.com/dSHARP-CMU/cmesh-dev/issues/153