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

pulibrary / orcid_princeton_hanami / 89456246-e228-49d1-bc83-2a86390d52e3

21 Nov 2025 08:48PM UTC coverage: 99.825% (-0.2%) from 100.0%
89456246-e228-49d1-bc83-2a86390d52e3

Pull #146

circleci

kelynch
Addressing settings change
Pull Request #146: Upgrading hanami to 2.3.0

570 of 571 relevant lines covered (99.82%)

7.7 hits per line

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

96.55
/app/views/user/show.rb
1
# frozen_string_literal: true
2

3
module OrcidPrinceton
1✔
4
  module Views
1✔
5
    module User
1✔
6
      # class to display user information
7
      class Show < OrcidPrinceton::View
1✔
8
        expose :user
1✔
9

10
        expose :dom_id do |user|
1✔
11
          "user_#{user.id}"
13✔
12
        end
13

14
        expose :orcid_url do |user|
1✔
15
          if Hanami.app.settings.orcid_sandbox
13✔
16
            "https://sandbox.orcid.org/#{user.orcid}"
13✔
17
          else
18
            "https://orcid.org/#{user.orcid}"
×
19
          end
20
        end
21

22
        expose :user_url do |user|
1✔
23
          Hanami.app.router.url(:user_json, id: user.id)
13✔
24
        end
25

26
        expose :display_name do |user|
1✔
27
          name = user.display_name
13✔
28
          if user.admin?
13✔
29
            "#{name} (Administrator)"
1✔
30
          else
31
            name
12✔
32
          end
33
        end
34

35
        expose :token_prompt do |token_empty, token_expired, user|
1✔
36
          prompt = if token_empty
13✔
37
                     "There is no ORCID iD associated with your NetID, #{user.uid}"
7✔
38
                   elsif token_expired
6✔
39
                     'Your ORCID token has expired. Please click the button below to ' \
2✔
40
                       're-authorize Princeton University to access your ORCID record.'
41
                   else
42
                     ''
4✔
43
                   end
44
          prompt
13✔
45
        end
46

47
        expose :token_expired do |user, orcid_available|
1✔
48
          user.tokens_expired? && orcid_available
13✔
49
        end
50

51
        expose :token_empty do |user|
1✔
52
          user.orcid.nil? || user.orcid.empty? || user.tokens.count.zero?
13✔
53
        end
54
      end
55
    end
56
  end
57
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