Sha256: 7220576665a178d5b9aed71e19f74b4b3cc39bdc5c7ab7e9fdf722e6e7df5536

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module Geoblacklight
  module ViewHelperOverride
    include CatalogHelperOverride

    def spatial_parameters?
      params[:bbox]
    end

    # Overrides BL method to enable results for spatial only params
    def has_search_parameters?
      spatial_parameters? || super
    end

    def query_has_constraints?(localized_params = params)
      has_search_parameters? || super(localized_params)
    end

    def render_search_to_s(params)
      super + render_search_to_s_bbox(params)
    end

    def render_search_to_s_bbox(params)
      return ''.html_safe if params['bbox'].blank?
      render_search_to_s_element(t('geoblacklight.bbox_label'), render_filter_value(params['bbox']))
    end

    def render_constraints_filters(localized_params = params)
      content = super(localized_params)
      localized_params = localized_params.to_unsafe_h if localized_params.respond_to?(:to_unsafe_h)

      if localized_params[:bbox]
        path = search_action_path(remove_spatial_filter_group(:bbox, localized_params))
        content << render_constraint_element(t('geoblacklight.bbox_label'),
                                             localized_params[:bbox], remove: path)
      end

      content
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geoblacklight-2.4.0 lib/geoblacklight/view_helper_override.rb