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

pulibrary / tigerdata-app / 7291b10e-eaa3-4284-9371-5a980ceebf59

24 Nov 2025 07:18PM UTC coverage: 87.613% (-3.7%) from 91.333%
7291b10e-eaa3-4284-9371-5a980ceebf59

push

circleci

web-flow
Adds breadcrumb to Wizard (#2231)

Adds the breadcrumb to the Wizard and the functionality to allow the
user to save their changes before leaving the Wizard when clicking on
the "Dashboard" link in the breadcrumbs.

Closes #2102

5 of 12 new or added lines in 11 files covered. (41.67%)

904 existing lines in 36 files now uncovered.

2801 of 3197 relevant lines covered (87.61%)

360.23 hits per line

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

86.42
/app/presenters/request_presenter.rb
1
# frozen_string_literal: true
2
class RequestPresenter
4✔
3
  attr_reader :request
4✔
4
  def initialize(request)
4✔
5
    @request = request
51✔
6
  end
7

8
  def eligible_to_edit?(user)
4✔
UNCOV
9
    return false if user.nil?
10✔
UNCOV
10
    if request.submitted?
10✔
UNCOV
11
      user.eligible_sysadmin?
4✔
12
    else
UNCOV
13
      user.uid == request.requested_by || user.eligible_sysadmin?
6✔
14
    end
15
  end
16

17
  def data_sponsor
4✔
UNCOV
18
    full_name(request.data_sponsor)
1✔
19
  end
20

21
  def data_manager
4✔
UNCOV
22
    full_name(request.data_manager)
2✔
23
  end
24

25
  def project_directory
4✔
26
    request.parent_folder.present? ? File.join(request.parent_folder, request.project_folder) : request.project_folder
×
27
  end
28

29
  def project_purpose
4✔
30
    ProjectPurpose.label_for(request.project_purpose)
×
31
  end
32

33
  def departments_list
4✔
UNCOV
34
    return "" if request.departments.blank?
2✔
UNCOV
35
    dept_list = []
1✔
UNCOV
36
    request.departments.each do |dept|
1✔
UNCOV
37
      dept_list << "#{dept['name']} (#{dept['code']})"
2✔
38
    end
UNCOV
39
    dept_list.join(", ")
1✔
40
  end
41

42
  def user_list
4✔
UNCOV
43
    return "" if request.user_roles.blank?
2✔
UNCOV
44
    usr_list = []
1✔
UNCOV
45
    request.user_roles.each do |usr|
1✔
UNCOV
46
      name = full_name(usr["uid"])
2✔
UNCOV
47
      name += " read only" if usr["read_only"]
2✔
UNCOV
48
      usr_list << name
2✔
49
    end
UNCOV
50
    usr_list.join(", ")
1✔
51
  end
52

53
  def full_name(uid)
4✔
UNCOV
54
    return "" if uid.blank?
8✔
UNCOV
55
    user = User.find_by(uid: uid)
6✔
UNCOV
56
    user.display_name_safe.to_s
6✔
57
  end
58

59
  # Returns the correct CSS class suffix for the sidebar navigation progress for a given
60
  # step/substep.
61
  def sidebar_progress(controller, step, substep = nil)
4✔
62
    controller_name = controller.controller_name
60✔
63
    case step
60✔
64
    when 1
65
      step1_css_suffix(controller_name, substep)
24✔
66
    when 2
67
      step2_css_suffix(controller_name)
12✔
68
    when 3
69
      step3_css_suffix(controller_name)
12✔
70
    when 4
71
      step4_css_suffix(controller_name)
12✔
72
    else
73
      "-incomplete"
×
74
    end
75
  end
76

77
  private
4✔
78

79
    def step1_css_suffix(controller_name, substep = nil)
4✔
80
      css_suffix = "-incomplete"
24✔
81
      if substep.nil?
24✔
82
        return "-current" if controller_name.start_with?("project_information")
12✔
83
        if step1_valid?
8✔
84
          css_suffix = "-completed"
×
85
        end
86
      elsif substep == "Basic Details"
12✔
87
        return "-current" if controller_name == "project_information"
12✔
88
        if step1_valid?
10✔
89
          css_suffix = "-completed"
×
90
        end
91
      end
92
      css_suffix
18✔
93
    end
94

95
    def step2_css_suffix(controller_name)
4✔
96
      return "-current" if controller_name == "roles_and_people"
12✔
97
      if step2_valid?
11✔
98
        "-completed"
×
99
      else
100
        "-incomplete"
11✔
101
      end
102
    end
103

104
    def step3_css_suffix(controller_name)
4✔
105
      return "-current" if controller_name == "storage_and_access"
12✔
106
      if step3_valid?
11✔
107
        "-completed"
×
108
      else
109
        "-incomplete"
11✔
110
      end
111
    end
112

113
    def step4_css_suffix(controller_name)
4✔
114
      return "-current" if controller_name == "review_and_submit"
12✔
115
      if step4_valid?
10✔
116
        "-completed"
×
117
      else
118
        "-incomplete"
10✔
119
      end
120
    end
121

122
    def step1_valid?
4✔
123
      return false if request.project_title.blank? || request.project_folder.blank? || request.project_purpose.blank? || request.description.blank? || request.departments.blank?
28✔
124
      true
×
125
    end
126

127
    def step2_valid?
4✔
128
      return false if request.data_manager.blank? || request.data_sponsor.blank?
11✔
129
      true
×
130
    end
131

132
    def step3_valid?
4✔
133
      return false if request.storage_size.nil?
11✔
134
      true
×
135
    end
136

137
    def step4_valid?
4✔
138
      step1_valid? && step2_valid? && step3_valid?
10✔
139
    end
140
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