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

pulibrary / orangelight / 0e37073d-109c-440c-949f-49d2aa86311b

18 Aug 2025 09:05PM UTC coverage: 0.482% (-94.9%) from 95.343%
0e37073d-109c-440c-949f-49d2aa86311b

push

circleci

web-flow
Replace per_page_options_for_select with custom component to avoid deprecation issue (#5186)

* Start creating new component to address deprecaton warning

* Replace per_page_options_for_select with custom component to avoid deprecation issue

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

---------

Co-authored-by: Ryan Jensen <rj1044@princeton.edu>
Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

0 of 33 new or added lines in 1 file covered. (0.0%)

9374 existing lines in 213 files now uncovered.

47 of 9753 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/controllers/concerns/orangelight/catalog.rb
1
# frozen_string_literal: true
2

UNCOV
3
module Orangelight
×
UNCOV
4
  module Catalog
×
UNCOV
5
    extend ActiveSupport::Concern
×
6

UNCOV
7
    def oclc
×
UNCOV
8
      redirect_to oclc_resolve(params[:id])
×
UNCOV
9
    end
×
10

UNCOV
11
    def isbn
×
UNCOV
12
      redirect_to isbn_resolve(params[:id])
×
UNCOV
13
    end
×
14

UNCOV
15
    def issn
×
UNCOV
16
      redirect_to issn_resolve(params[:id])
×
UNCOV
17
    end
×
18

UNCOV
19
    def lccn
×
UNCOV
20
      redirect_to lccn_resolve(params[:id])
×
UNCOV
21
    end
×
22

UNCOV
23
    def alma
×
UNCOV
24
      bib_id = params[:BBID] || params[:bbid]
×
UNCOV
25
      redirect_to "/catalog/#{bib_id}"
×
UNCOV
26
    end
×
27

UNCOV
28
    def redirect_browse
×
UNCOV
29
      if params[:search_field] && params[:controller] != 'advanced'
×
UNCOV
30
        if params[:search_field] == 'browse_subject' && !params[:id]
×
UNCOV
31
          redirect_to "/browse/subjects?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
UNCOV
32
        elsif params[:search_field] == 'browse_cn' && !params[:id]
×
UNCOV
33
          redirect_to "/browse/call_numbers?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
UNCOV
34
        elsif params[:search_field] == 'browse_name' && !params[:id]
×
UNCOV
35
          redirect_to "/browse/names?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
UNCOV
36
        elsif params[:search_field] == 'name_title' && !params[:id]
×
UNCOV
37
          redirect_to "/browse/name_titles?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
UNCOV
38
        end
×
UNCOV
39
      end
×
UNCOV
40
    end
×
41

42
    # Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
UNCOV
43
    def email_action(documents)
×
UNCOV
44
      mail = Orangelight::RecordMailer.email_record(documents, { to: params[:to], reply_to: user_email, message: params[:message], subject: params[:subject] }, url_options)
×
UNCOV
45
      if mail.respond_to? :deliver_later
×
UNCOV
46
        mail.deliver_later
×
UNCOV
47
      else
×
48
        mail.deliver
×
UNCOV
49
      end
×
UNCOV
50
    end
×
51

52
    # rubocop:disable Naming/PredicateMethod
UNCOV
53
    def validate_email_params
×
UNCOV
54
      if current_user.nil?
×
UNCOV
55
        flash[:error] = 'You must be logged in to send an email.'
×
UNCOV
56
      elsif params[:to].blank?
×
57
        flash[:error] = I18n.t('blacklight.email.errors.to.blank')
×
UNCOV
58
      elsif !params[:to].match(Blacklight::Engine.config.blacklight.email_regexp)
×
59
        flash[:error] = I18n.t('blacklight.email.errors.to.invalid', to: params[:to])
×
UNCOV
60
      end
×
61

UNCOV
62
      flash[:error].blank?
×
UNCOV
63
    end
×
64
    # rubocop:enable Naming/PredicateMethod
65

UNCOV
66
    def user_email
×
UNCOV
67
      return current_user.email if current_or_guest_user.cas_provider?
×
UNCOV
68
    end
×
69

UNCOV
70
    def online_holding_note?(_field_config, document)
×
UNCOV
71
      location_notes = JSON.parse(document[:holdings_1display] || '{}').collect { |_k, v| v['location_has'] }
×
UNCOV
72
      document[:electronic_access_1display].present? && location_notes.any? && document[:location].blank?
×
UNCOV
73
    end
×
74

UNCOV
75
    def linked_records
×
UNCOV
76
      return head(:bad_request) unless params[:id] && params[:field]
×
77

UNCOV
78
      begin
×
UNCOV
79
        document = search_service.fetch(params[:id])
×
UNCOV
80
      rescue Blacklight::Exceptions::RecordNotFound
×
UNCOV
81
        return head(:bad_request)
×
UNCOV
82
      end
×
83

UNCOV
84
      render json: document.linked_records(field: params[:field], maximum_records: 500).decorated
×
UNCOV
85
    end
×
UNCOV
86
  end
×
UNCOV
87
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