• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 8aaba373-f0b4-4252-9ac9-c74a34a79f8e

25 Aug 2023 02:12PM UTC coverage: 95.383% (-0.05%) from 95.433%
8aaba373-f0b4-4252-9ac9-c74a34a79f8e

Pull #3700

circleci

maxkadel
Respond to review
Pull Request #3700: I3412 built in advanced search form

19 of 24 new or added lines in 1 file covered. (79.17%)

5578 of 5848 relevant lines covered (95.38%)

1418.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.17
/app/components/orangelight/advanced_search_form_component.rb
1
# frozen_string_literal: true
2

3
class Orangelight::AdvancedSearchFormComponent < Blacklight::AdvancedSearchFormComponent
2✔
4
  def sort_fields_select
2✔
5
    options = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] }
112✔
6
    return unless options.any?
16✔
7

8
    select_tag(:sort, options_for_select(options, params[:sort]), class: "sort-select", aria: { labelledby: 'advanced-search-sort-label' })
16✔
9
  end
10

11
  def initialize_search_filter_controls
2✔
12
    fields = blacklight_config.facet_fields.select { |_k, v| v.include_in_advanced_search || v.include_in_advanced_search.nil? }
640✔
13

14
    fields.each do |_k, config|
8✔
15
      config.advanced_search_component = Orangelight::FacetFieldCheckboxesComponent
632✔
16
      display_facet = @response.aggregations[config.field]
632✔
17
      with_search_filter_control(config:, display_facet:)
632✔
18
    end
19
  end
20

21
  def pub_date_field
2✔
22
    blacklight_config.facet_fields['pub_date_start_sort']
24✔
23
  end
24

25
  def pub_date_presenter
2✔
26
    view_context.facet_field_presenter(pub_date_field, {})
16✔
27
  end
28

29
  def initialize_search_field_controls
2✔
30
    search_fields.values.each.with_index do |field, index|
8✔
31
      with_search_field_control do
80✔
NEW
32
        generate_fields(index:, field:)
×
33
      end
34
    end
35
  end
36

37
  def fields_for_etc(index:, field:)
2✔
NEW
38
    fields_for('clause[]', index, include_id: false) do |foo|
×
NEW
39
      content_tag(:div, class: 'form-group advanced-search-field row mb-3') do
×
NEW
40
        foo.label(:query, field.display_label('search'), class: "col-sm-3 col-form-label text-md-right") +
×
41
          content_tag(:div, class: 'col-sm-9') do
NEW
42
            foo.hidden_field(:field, value: field.key) +
×
43
              foo.text_field(:query, value: query_for_search_clause(field.key), class: 'form-control')
44
          end
45
      end
46
    end
47
  end
48
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc