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

pulibrary / orangelight / 4e01fe00-694b-47b4-8b30-2de4dc4acc66

31 Jul 2025 07:56PM UTC coverage: 92.891% (-2.5%) from 95.4%
4e01fe00-694b-47b4-8b30-2de4dc4acc66

Pull #4962

circleci

web-flow
Merge pull request #5130 from pulibrary/clean_up_scss_comments

Remove SCSS commented code.
Pull Request #4962: Orangelight pos workcycle 07-07-2025

193 of 197 new or added lines in 24 files covered. (97.97%)

161 existing lines in 35 files now uncovered.

5932 of 6386 relevant lines covered (92.89%)

1443.08 hits per line

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

65.96
/app/controllers/concerns/orangelight/catalog.rb
1
# frozen_string_literal: true
2

3
module Orangelight
2✔
4
  module Catalog
2✔
5
    extend ActiveSupport::Concern
2✔
6

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

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

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

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

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

28
    def redirect_browse
2✔
29
      if params[:search_field] && params[:controller] != 'advanced'
306✔
30
        if params[:search_field] == 'browse_subject' && !params[:id]
69✔
UNCOV
31
          redirect_to "/browse/subjects?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
32
        elsif params[:search_field] == 'browse_cn' && !params[:id]
69✔
UNCOV
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]
69✔
UNCOV
35
          redirect_to "/browse/names?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
×
36
        elsif params[:search_field] == 'name_title' && !params[:id]
69✔
UNCOV
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)
2✔
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
×
47
      else
48
        mail.deliver
×
49
      end
50
    end
51

52
    # rubocop:disable Naming/PredicateMethod
53
    def validate_email_params
2✔
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])
×
60
      end
61

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

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

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

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

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

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