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

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

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

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

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

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

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