Skip to content

Commit

Permalink
enhance UI: Display collapsible linked custom metadata attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
whomingbird committed Aug 14, 2023
1 parent 2690a47 commit 70a1311
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
21 changes: 20 additions & 1 deletion app/assets/stylesheets/linked_custom_metadata.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,23 @@
padding: 10px 15px 10px 15px;
border-radius: 5px;
margin-bottom: 15px;
}
}

.linked_custom_metdata_display .panel-default .panel-heading {
font-weight: bold;
border: none;
background-color: #ffffff;
padding: 0px 0px;
}


.linked_custom_metdata_display .panel {
border: none;
box-shadow: none;
margin-bottom: 0px;
}

.linked_custom_metdata_display .panel-body {
padding: 0px 0px;
border-radius: 5px;
}
12 changes: 10 additions & 2 deletions app/helpers/samples_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,16 @@ def linked_custom_metadata_attribute_display(value, attribute)
attribute.linked_custom_metadata_type.custom_metadata_attributes.each do |attr|
v = value ? value[attr.title.to_s] : nil
html += '<li>'
html += '<label>'+attr.title+'</label>'+' : '
html += display_attribute_value(v, attr)
if attr.linked_custom_metadata? || attr.linked_custom_metadata_multi?
html += content_tag(:span, class: 'linked_custom_metdata_display') do
folding_panel(attr.label, true, id:attr.title) do
display_attribute_value(v, attr)
end
end
else
html += '<label>'+attr.title+'</label>'+' : '
html += display_attribute_value(v, attr)
end
html += '</li>'
end
html += '</ul>'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@

<% resource.custom_metadata.custom_metadata_attributes.each do |attribute| %>
<% unless resource.custom_metadata.data[attribute.title].blank? %>
<p>
<label><%= attribute.label %>:</label>
<%= display_attribute(resource.custom_metadata, attribute, link: true) %>
</p>
<div>
<% if attribute.linked_custom_metadata? || attribute.linked_custom_metadata_multi? %>
<%= content_tag(:span, class: 'linked_custom_metdata_display') do %>
<%= folding_panel(attribute.label, true, id:attribute.title) do %>
<%= display_attribute(resource.custom_metadata, attribute, link: true) %>
<% end %>
<% end %>
<% else %>
<label><%= attribute.label %>:</label>
<%= display_attribute(resource.custom_metadata, attribute, link: true) %>
<% end %>
</div>
<% end %>
<% end %>

</div>
</div>

<% else %>

<% end %>

0 comments on commit 70a1311

Please sign in to comment.