Skip to content

Commit ac032b1

Browse files
authored
Add project path and data sponsor/data manager badges to project summary heading (#2253)
Closes #2179
1 parent c748b19 commit ac032b1

File tree

5 files changed

+39
-6
lines changed

5 files changed

+39
-6
lines changed

app/assets/stylesheets/_project.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@
151151
}
152152
}
153153

154+
.lux-badge-inline {
155+
display: inline-flex !important;
156+
padding: 0 0.375rem !important;
157+
color: $black !important;
158+
font-size: 1rem !important;
159+
gap: 0.25rem;
160+
font-style: normal;
161+
font-weight: 400;
162+
line-height: 1.5rem; /* 150% */
163+
}
164+
154165
.basic-details-fields {
155166
padding-top: 30px;
156167
list-style-type: none;

app/assets/stylesheets/_projects.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@
8282
font-weight: bold;
8383
}
8484

85+
.date-and-data-info-single ul {
86+
padding: 0;
87+
}
88+
89+
.date-and-data-info-single li {
90+
list-style-type: none;
91+
line-height: 1em;
92+
}
93+
8594
.date-and-data-info ul {
8695
padding: 0;
8796
}

app/models/user.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,14 @@ def initialize_name_values(extra_cas_info)
8989
self.display_name = extra_cas_info.pudisplayname
9090
end
9191

92-
# Return the display name if it exists, otherwise return the uid
92+
# Return the display name and uid if it exists, otherwise return the uid
9393
# @return [String]
9494
def display_name_safe
9595
return uid if given_name.blank? && family_name.blank?
96-
9796
[given_name, family_name, "(#{uid})"].compact.join(" ")
9897
end
9998

100-
# Return the display name if it exists, otherwise return the uid
99+
# Return the display name only (no uid) if it exists, otherwise return the uid
101100
# @return [String]
102101
def display_name_only_safe
103102
return uid if given_name.blank? && family_name.blank?

app/views/projects/_project_details_heading.html.erb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
<a id="show-more-less-link" class="show-more" href="#"><span>more</span></a>
2323
</div><!-- #project-description -->
2424

25+
<div class="row">
26+
<div class="col-12">
27+
<div class="date-and-data-info-single">
28+
<ul>
29+
<li><span class="label" id="project-path-copy">Project Directory:</span> <%= @presenter.project_directory %></li>
30+
</ul>
31+
</div>
32+
</div>
33+
</div>
34+
2535
<div class="row">
2636
<div class="col-12">
2737
<div class="date-and-data-info">
@@ -31,14 +41,14 @@
3141
</ul>
3242
</div>
3343
</div>
34-
</div><!-- .row -->
44+
</div>
3545

3646
<div class="row">
3747
<div class="col-12">
3848
<div class="date-and-data-info">
3949
<ul>
40-
<li><span class="label">Data Sponsor:</span> <span class="netid-large"><%= @presenter.data_sponsor&.uid %></span></li>
41-
<li><span class="label">Data Manager:</span> <span class="netid-large"><%= @presenter.data_manager&.uid %></span></li>
50+
<li class="info-container"><span class="label">Data Sponsor:</span> <%= @presenter.data_sponsor.display_name_only_safe %><span class="lux-badge lux-badge-gray badge-text lux-badge-inline"><%= @presenter.data_sponsor&.uid %></span></li>
51+
<li class="info-container"><span class="label">Data Manager:</span> <%= @presenter.data_manager.display_name_only_safe %><span class="lux-badge lux-badge-gray badge-text lux-badge-inline"><%= @presenter.data_manager&.uid %></span></li>
4252
</ul>
4353
</div>
4454
</div><!-- .col-12 -->

spec/system/project_details_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
expect(page).to have_selector("#description-text")
3535
expect(page).to have_selector("#description-text-full")
3636

37+
# Make sure project path is rendered
38+
expect(page).to have_css "#project-path-copy"
39+
expect(page).to have_content(project_in_mediaflux.project_directory)
40+
3741
# Make sure both data manager and sponsor are rendered
3842
expect(page).to have_content("#{data_manager.display_name} (#{data_manager.uid})")
3943
expect(page).to have_content("#{sponsor_user.display_name} (#{sponsor_user.uid})")

0 commit comments

Comments
 (0)