Sha256: 78cbbdf301d711f0064682f5843ffeba691709637d74619cdd9e605041e0e67f

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 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 unless localized_params.is_a?(Hash)

      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

13 entries across 13 versions & 1 rubygems

Version Path
geoblacklight-2.3.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-2.2.1 lib/geoblacklight/view_helper_override.rb
geoblacklight-2.2.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-2.1.2 lib/geoblacklight/view_helper_override.rb
geoblacklight-2.1.1 lib/geoblacklight/view_helper_override.rb
geoblacklight-2.1.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-2.0.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-1.9.1 lib/geoblacklight/view_helper_override.rb
geoblacklight-1.9.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-1.8.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-1.7.1 lib/geoblacklight/view_helper_override.rb
geoblacklight-1.7.0 lib/geoblacklight/view_helper_override.rb
geoblacklight-1.6.0 lib/geoblacklight/view_helper_override.rb