Module: BlacklightMaps::RenderConstraintsOverride

Defined in:
lib/blacklight/maps/render_constraints_override.rb

Instance Method Summary collapse

Instance Method Details

#has_search_parameters?Boolean

BlacklightMaps override: update to look for spatial query params


9
10
11
# File 'lib/blacklight/maps/render_constraints_override.rb', line 9

def has_search_parameters?
  has_spatial_parameters? || super
end

#has_spatial_parameters?Boolean


13
14
15
# File 'lib/blacklight/maps/render_constraints_override.rb', line 13

def has_spatial_parameters?
  !params[:coordinates].blank?
end

#query_has_constraints?(localized_params = params) ⇒ Boolean

BlacklightMaps override: check for coordinate parameters


18
19
20
# File 'lib/blacklight/maps/render_constraints_override.rb', line 18

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

#render_constraints(localized_params = params) ⇒ Object

BlacklightMaps override: include render_spatial_query() in rendered constraints


23
24
25
# File 'lib/blacklight/maps/render_constraints_override.rb', line 23

def render_constraints(localized_params = params)
  render_spatial_query(localized_params) + super
end

#render_search_to_s(params) ⇒ Object

BlacklightMaps override: include render_search_to_s_coord() in rendered constraints Simpler textual version of constraints, used on Search History page.


29
30
31
# File 'lib/blacklight/maps/render_constraints_override.rb', line 29

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

#render_search_to_s_coord(params) ⇒ Object

Render the search query constraint


35
36
37
38
# File 'lib/blacklight/maps/render_constraints_override.rb', line 35

def render_search_to_s_coord(params)
  return "".html_safe if params[:coordinates].blank?
  render_search_to_s_element(spatial_constraint_label(params), render_filter_value(params[:coordinates]) )
end

#render_spatial_query(localized_params = params) ⇒ Object

Render the spatial query constraints


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/blacklight/maps/render_constraints_override.rb', line 41

def render_spatial_query(localized_params = params)
  # So simple don't need a view template, we can just do it here.
  return ''.html_safe if localized_params[:coordinates].blank?

  render_constraint_element(spatial_constraint_label(localized_params),
                            localized_params[:coordinates],
                            :classes => ['coordinates'],
                            :remove => remove_constraint_url(localized_params.merge(:coordinates=>nil,
                                                                                    :spatial_search_type=>nil,
                                                                                    :action=>'index')))
end

#spatial_constraint_label(params) ⇒ Object


53
54
55
56
57
# File 'lib/blacklight/maps/render_constraints_override.rb', line 53

def spatial_constraint_label(params)
  (params[:spatial_search_type] && params[:spatial_search_type] == 'bbox') ?
      t('blacklight.search.filters.coordinates.bbox') :
      t('blacklight.search.filters.coordinates.point')
end