Skip to content

Extract facet presenters and components #2268

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

Merged
merged 6 commits into from
Apr 1, 2020

Conversation

cbeer
Copy link
Member

@cbeer cbeer commented Mar 30, 2020

An alternative to #2168. This PR adds view components for facet fields and facet items, and updates views and helpers to call into the components while preserving backwards compatibility for downstream applications which may have overridden the helpers.

This PR also allows downstream applications to use custom components using a couple new field configuration parameters:

config.add_facet_field 'whatever', component: MyCustomFacetFieldComponent
config.add_facet_field 'whatever', item_component: MyCustomItemRenderingComponent

Most of the added code here is to preserve backwards compatibility and can be removed or reshuffled as part of a major release. I've also marked some methods with the @deprecated yard tag that I expect to go away as part of another major release (or we can decide to just drop for 8.0), and with @private for methods that are only exposed publicly for backwards compatibility.

@cbeer cbeer force-pushed the facet-presenter-view-component branch from acc5039 to bed12bb Compare March 31, 2020 18:10
@cbeer cbeer marked this pull request as ready for review April 1, 2020 15:56
@@ -1,5 +1,8 @@
# frozen_string_literal: true
module Blacklight::FacetsHelperBehavior
Copy link
Member Author

Choose a reason for hiding this comment

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

It's a little hard to tell from the diff, but as a result of this PR, the only non-deprecated helpers are:

  • has_facet_values? (probably not long for this world)
  • render_facet_partials (perhaps part of a future component)
  • render_facet_limit (possibly obsolete once components get traction)
  • facet_field_in_params (a little tricky to deprecate at the moment)
  • facet_field_presenter

@cbeer cbeer force-pushed the facet-presenter-view-component branch from 261fa84 to 01e0c3f Compare April 1, 2020 17:26
@jcoyne jcoyne merged commit 8b86f9e into master Apr 1, 2020
@jcoyne jcoyne deleted the facet-presenter-view-component branch April 1, 2020 18:18
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.

2 participants