module BlacklightAdvancedSearch::RenderConstraintsOverride
Public Instance Methods
date_range_constraints_to_s(params)
click to toggle source
render date range constraint text from Advanced Search form
# File lib/generators/newspaper_works/templates/config/initializers/patch_blacklight_advanced_search.rb, line 69 def date_range_constraints_to_s(params) return "#{params[:date_end]} or before" if params[:date_start].blank? return "#{params[:date_start]} or later" if params[:date_end].blank? "#{params[:date_start]}-#{params[:date_end]}" end
render_advanced_date_query(localized_params = params)
click to toggle source
render the advanced search date query constraints
# File lib/generators/newspaper_works/templates/config/initializers/patch_blacklight_advanced_search.rb, line 58 def render_advanced_date_query(localized_params = params) return ''.html_safe if localized_params[:date_start].blank? && localized_params[:date_end].blank? render_constraint_element(t('blacklight.advanced_search.constraints.date'), date_range_constraints_to_s(localized_params), classes: ['date_range'], remove: remove_constraint_url(localized_params.merge(date_start: nil, date_end: nil, action: 'index'))) end
render_constraints_filters(my_params = params)
click to toggle source
override to add date range to constraints rendering
Calls superclass method
# File lib/generators/newspaper_works/templates/config/initializers/patch_blacklight_advanced_search.rb, line 41 def render_constraints_filters(my_params = params) # these lines are copied from source content = super(my_params) if advanced_query advanced_query.filters.each_pair do |field, value_list| label = facet_field_label(field) content << render_constraint_element(label, safe_join(Array(value_list), " <strong class='text-muted constraint-connector'>OR</strong> ".html_safe), remove: search_action_path(remove_advanced_filter_group(field, my_params).except(:controller, :action))) end # this is our new line content << render_advanced_date_query(my_params) end content end