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

pulibrary / orcid_princeton_hanami / 58bf55de-6875-4d28-8490-070da9c0f8dc

02 Dec 2025 09:46PM UTC coverage: 98.761% (-1.2%) from 100.0%
58bf55de-6875-4d28-8490-070da9c0f8dc

Pull #152

circleci

web-flow
Update dependency rack to v3
Pull Request #152: Update dependency rack to v3

558 of 565 relevant lines covered (98.76%)

4.24 hits per line

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

86.21
/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}"
4✔
12
        end
13

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

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

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

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

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

51
        expose :token_empty do |user|
1✔
52
          user.orcid.nil? || user.orcid.empty? || user.tokens.count.zero?
4✔
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