• 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

76.19
/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✔
17
    stored_location = stored_location_for(resource)
2✔
18
    if referrer.present? && referrer.exclude?("sign_in") && !origin&.include?("redirect-to-alma")
2✔
UNCOV
19
      referrer
×
20
    elsif origin.present?
2✔
21
      request.flash.delete('alert')
2✔
22
      request.flash.keep('notice')
2✔
23
      origin.chomp('/email')
2✔
UNCOV
24
    elsif !request.env['omniauth.origin'].nil? &&
×
25
          /request|borrow-direct|email|bookmarks|search_history|redirect-to-alma/.match(request.env['omniauth.origin'])
UNCOV
26
      referrer_from_url(request.env['omniauth.origin'])
×
UNCOV
27
    elsif stored_location.present?
×
UNCOV
28
      stored_location
×
29
    else
UNCOV
30
      account_path
×
31
    end
32
  end
33

34
  def referrer
2✔
35
    @referrer ||= params[:url] || request.referer
9✔
36
  end
37

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

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

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

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

61
  private
2✔
62

63
    def verify_admin!
2✔
64
      authenticate_user!
5✔
65
      head :forbidden unless current_user.admin?
4✔
66
    end
67

68
    def referrer_from_url(url)
2✔
UNCOV
69
      query = URI.parse(url).query
×
UNCOV
70
      if query
×
UNCOV
71
        CGI.parse(query).try(:[], "referer")&.first
×
72
      else
UNCOV
73
        url
×
74
      end
75
    end
76

77
    before_action do
2✔
78
      Rack::MiniProfiler.authorize_request if current_user&.admin?
465✔
79
    end
80
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