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

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

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

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

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

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

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

28
    def redirect_browse
×
29
      if params[:search_field] && params[:controller] != 'advanced'
×
30
        if params[:search_field] == 'browse_subject' && !params[:id]
×
31
          redirect_to "/browse/subjects?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
32
        elsif params[:search_field] == 'browse_cn' && !params[:id]
×
33
          redirect_to "/browse/call_numbers?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
34
        elsif params[:search_field] == 'browse_name' && !params[:id]
×
35
          redirect_to "/browse/names?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
36
        elsif params[:search_field] == 'name_title' && !params[:id]
×
37
          redirect_to "/browse/name_titles?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
38
        end
×
39
      end
×
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)
43
    def email_action(documents)
×
44
      mail = Orangelight::RecordMailer.email_record(documents, { to: params[:to], reply_to: user_email, message: params[:message], subject: params[:subject] }, url_options)
×
45
      if mail.respond_to? :deliver_later
×
46
        mail.deliver_later
×
47
      else
×
48
        mail.deliver
×
49
      end
×
50
    end
×
51

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

61
      flash[:error].blank?
×
62
    end
×
63

64
    def user_email
×
65
      return current_user.email if current_or_guest_user.cas_provider?
×
66
    end
×
67

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

73
    def linked_records
×
74
      return head(:bad_request) unless params[:id] && params[:field]
×
75

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

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