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

pulibrary / orcid_princeton_hanami / d28ce42c-6921-45d8-8241-16192332d785

21 Nov 2025 06:51PM UTC coverage: 99.474% (-0.5%) from 100.0%
d28ce42c-6921-45d8-8241-16192332d785

Pull #146

circleci

carolyncole
Upgrading hanami to 2.3.0

 Co-authored-by: Kate Lynch <kelynch@users.noreply.github.com>
Pull Request #146: Upgrading hanami to 2.3.0

567 of 570 relevant lines covered (99.47%)

7.85 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}"
11✔
12
        end
13

14
        expose :orcid_url do |user|
1✔
15
          if Hanami.app.settings.orcid_sandbox
11✔
16
            "https://sandbox.orcid.org/#{user.orcid}"
11✔
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)
11✔
24
        end
25

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

35
        expose :token_prompt do |token_empty, token_expired, user|
1✔
36
          prompt = if token_empty
11✔
37
                     "There is no ORCID iD associated with your NetID, #{user.uid}"
5✔
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
11✔
45
        end
46

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

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