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

pulibrary / orangelight / 25bfe78f-c539-4492-9179-151d22460b61

30 Aug 2024 08:17PM UTC coverage: 45.357% (-50.4%) from 95.758%
25bfe78f-c539-4492-9179-151d22460b61

push

circleci

web-flow
Merge pull request #4168 from pulibrary/left_anchor_iii

Left anchor search

23 of 23 new or added lines in 1 file covered. (100.0%)

3090 existing lines in 140 files now uncovered.

2779 of 6127 relevant lines covered (45.36%)

7.28 hits per line

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

37.84
/app/controllers/application_controller.rb
1
# frozen_string_literal: true
2

3
class ApplicationController < ActionController::Base
2✔
4
  # Adds a few additional behaviors into the application controller
5
  include Blacklight::Controller
2✔
6

7
  # Please be sure to impelement current_user and user_session. Blacklight depends on
8
  # these methods in order to perform user specific actions.
9

10
  layout 'application'
2✔
11

12
  # Prevent CSRF attacks by raising an exception.
13
  # For APIs, you may want to use :null_session instead.
14
  protect_from_forgery with: :exception
2✔
15

16
  def after_sign_in_path_for(resource)
2✔
UNCOV
17
    stored_location = stored_location_for(resource)
×
18

UNCOV
19
    if referrer.present? && (referrer.exclude?("sign_in") && !origin&.include?("redirect-to-alma"))
×
UNCOV
20
      referrer
×
UNCOV
21
    elsif origin.present?
×
UNCOV
22
      request.flash.delete('alert')
×
UNCOV
23
      request.flash.keep('notice')
×
UNCOV
24
      origin.chomp('/email')
×
UNCOV
25
    elsif !request.env['omniauth.origin'].nil? &&
×
26
          /request|borrow-direct|email|bookmarks|search_history|redirect-to-alma/.match(request.env['omniauth.origin'])
UNCOV
27
      request.env['omniauth.origin']
×
UNCOV
28
    elsif stored_location.present?
×
UNCOV
29
      stored_location
×
30
    else
UNCOV
31
      account_path
×
32
    end
33
  end
34

35
  def referrer
2✔
UNCOV
36
    @referrer ||= params[:url] || request.referer
×
37
  end
38

39
  def origin
2✔
UNCOV
40
    @origin ||= begin
×
UNCOV
41
      return params[:origin] if params[:origin].present?
×
42

UNCOV
43
      if referrer.present? && referrer.include?("origin")
×
UNCOV
44
        referrer_params = Rack::Utils.parse_query URI.parse(referrer).query
×
UNCOV
45
        return referrer_params["origin"]
×
46
      end
47
    end
48
  end
49

50
  def after_sign_out_path_for(resource)
2✔
UNCOV
51
    if resource == 'barcode' || resource == "alma"
×
UNCOV
52
      root_url
×
53
    else
UNCOV
54
      Rails.configuration.x.after_sign_out_url
×
55
    end
56
  end
57

58
  def default_url_options
2✔
59
    Rails.env.production? || Rails.env.staging? ? { protocol: 'https' } : {}
233✔
60
  end
61

62
  private
2✔
63

64
    def verify_admin!
2✔
UNCOV
65
      authenticate_user!
×
UNCOV
66
      head :forbidden unless current_user.admin?
×
67
    end
68

69
    before_action do
2✔
70
      Rack::MiniProfiler.authorize_request if current_user&.admin?
25✔
71
    end
72
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

© 2026 Coveralls, Inc