app/presenters/blacklight/facet_item_presenter.rb in blacklight-7.40.0 vs app/presenters/blacklight/facet_item_presenter.rb in blacklight-8.0.0.beta1

- old
+ new

@@ -28,13 +28,11 @@ ## # Check if the query parameters have the given facet field with the # given value. def selected? - Deprecation.silence(Blacklight::SearchState) do - search_state.has_facet? facet_config, value: value - end + search_state.filter(facet_config).include?(value) end def field_label facet_field_presenter.label end @@ -42,12 +40,10 @@ ## # Get the displayable version of a facet's value # # @return [String] def label - return @view_context.facet_display_value(@facet_field, @facet_item) unless @view_context.method(:facet_display_value).owner == Blacklight::FacetsHelperBehavior - label_value = if facet_item.respond_to? :label facet_item.label else value end @@ -60,11 +56,11 @@ I18n.t("blacklight.search.facets.missing") elsif facet_config.date localization_options = facet_config.date == true ? {} : facet_config.date I18n.l(Time.zone.parse(label_value), **localization_options) else - label_value + label_value.to_s end end # Get the displayable version of the facet's value for use # in e.g. the constraints widget @@ -90,12 +86,10 @@ end end # @private def remove_href(path = search_state) - Deprecation.silence(Blacklight::SearchState) do - view_context.search_action_path(path.remove_facet_params(facet_config.key, facet_item)) - end + view_context.search_action_path(path.filter(facet_config.key).remove(facet_item)) end # @private def add_href(path_options = {}) if facet_config.url_method