Skip to content

Commit a4ceec3

Browse files
committed
Improve taxonomy string rendering
1 parent 50a4729 commit a4ceec3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ module ApplicationHelper
22
def show_tax_string(string, opts = {})
33
opts[:class] ||= 'tax-string'
44
content_tag(:span, opts) do
5-
string.split(/ (>|»|\/) /).each_with_index.map do |i, k|
5+
string = string.split(/ (>|»|\/) /) unless string.is_a?(Array)
6+
string.each_with_index.map do |i, k|
67
r, n = i.split(':', 2)
78
r_key = r.to_s[0].to_sym
89

9-
content_tag(:span, k == 0 ? '' : '»') +
10+
content_tag(:span, k == 0 ? '' : ' » '.html_safe) +
1011
content_tag(
1112
:span, n, title: Name.rank_keys[r_key],
1213
data: { kind: :taxonomy, rank: r_key, value: n }

app/views/registers/curation_genomics/_ambiguous_type_genome.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969
<td colspan=3>
7070
<b>Reported Classification:</b><br/>
7171
<%= show_tax_string(
72-
name.lineage.map { |i| "#{i.inferred_rank}:#{i.name}" }
73-
.join(' > '),
72+
name.lineage.map { |i| "#{i.inferred_rank}:#{i.name}" },
7473
id: "tax-#{name.id}-reported"
7574
) %>
7675
</td>

0 commit comments

Comments
 (0)