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

pulibrary / orangelight / 00dbc10b-d747-4ad7-b211-7b26d753abbb

14 Aug 2025 01:25PM UTC coverage: 0.483% (-94.9%) from 95.343%
00dbc10b-d747-4ad7-b211-7b26d753abbb

push

circleci

web-flow
Merge pull request #5181 from pulibrary/dependabot/bundler/activestorage-7.2.2.2

Bump activestorage from 7.2.2.1 to 7.2.2.2

47 of 9721 relevant lines covered (0.48%)

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

40
        if context.action_name == "show"
×
41
          link_to(value, "/?f[#{facet_field}][]=#{strip_tags(CGI.escape(strip_tags(value)))}", class: search_class, 'data-original-title' => "Search: #{strip_tags(value)}") + ' ' +
×
42
            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)
×
43
        else
×
44
          link_to(value, "/?f[#{facet_field}][]=#{strip_tags(CGI.escape(strip_tags(value)))}", class: search_class, 'data-original-title' => "Search: #{strip_tags(value)}", dir: value.dir.to_s)
×
45
        end
×
46
      end
×
47

48
      def should_render_links?(value)
×
49
        return true unless config.browse_link == :name_title
×
50
        document['name_title_browse_s']&.include? value
×
51
      end
×
52
  end
×
53
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