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

pulibrary / orangelight / 62bad3f1-d46d-40af-822c-403d653da2a8

17 Jun 2025 05:30PM UTC coverage: 0.447% (-94.9%) from 95.337%
62bad3f1-d46d-40af-822c-403d653da2a8

push

circleci

maxkadel
Install chrome & chromedriver for smoke specs

43 of 9610 relevant lines covered (0.45%)

0.01 hits per line

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

0.0
/app/processors/orangelight/browse_link_processor.rb
1
# frozen_string_literal: true
2

3
module Orangelight
×
4
  class BrowseLinkProcessor < Blacklight::Rendering::AbstractStep
×
5
    include ActionView::Helpers::UrlHelper
×
6
    include ActionView::Helpers::SanitizeHelper
×
7

8
    def render
×
9
      return next_step(values) unless config.browse_link
×
10

11
      next_step(values.map { |value| add_links_to value })
×
12
    end
×
13

14
    private
×
15

16
      def facet_field
×
17
        case config.browse_link
×
18
        when :name
×
19
          'author_s'
×
20
        when :name_title
×
21
          'name_title_browse_s'
×
22
        end
×
23
      end
×
24

25
      def browse_path
×
26
        "#{config.browse_link}s"
×
27
      end
×
28

29
      def search_class
×
30
        "search-#{config.browse_link.to_s.tr('_', '-')}"
×
31
      end
×
32

33
      def browse_class
×
34
        "browse-#{config.browse_link.to_s.tr('_', '-')}"
×
35
      end
×
36

37
      def add_links_to(value)
×
38
        return value unless should_render_links?(value)
×
39
        link_to(value, "/?f[#{facet_field}][]=#{strip_tags(CGI.escape(strip_tags(value)))}", class: search_class, 'data-original-title' => "Search: #{strip_tags(value)}") + ' ' +
×
40
          link_to('[Browse]', "/browse/#{browse_path}?q=#{CGI.escape(strip_tags(value))}", class: browse_class, 'data-original-title' => "Browse: #{strip_tags(value)}", dir: value.dir.to_s)
×
41
      end
×
42

43
      def should_render_links?(value)
×
44
        return true unless config.browse_link == :name_title
×
45
        document['name_title_browse_s']&.include? value
×
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