Skip to content

Commit 1743788

Browse files
committed
Include types in register tree
1 parent 73899c8 commit 1743788

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

app/models/name.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def expected_parent_rank
940940
self.class.ranks[idx - 1] if idx && idx > 0
941941
end
942942

943-
def lineage
943+
def lineage(with_self: false)
944944
@lineage ||= nil
945945
return @lineage unless @lineage.nil?
946946

@@ -953,7 +953,7 @@ def lineage
953953
end
954954
@lineage.unshift(par)
955955
end
956-
@lineage.pop
956+
@lineage.pop unless with_self
957957
@lineage
958958
end
959959

app/models/register.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def fresh_tree
355355
{}.tap do |o|
356356
names.order(:name_order).each do |name_i|
357357
y = o
358-
name_i.lineage.each { |name_j| y = (y[name_j] ||= {}) }
358+
name_i.lineage(with_self: true).each { |name_j| y = (y[name_j] ||= {}) }
359359
end
360360
end
361361
end

app/views/registers/tree.html.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
<% def render_tree_node(n, contents) %>
99
<div class="ml-3">
10-
<%= display_link(n) if n %>
10+
<% if n.present? %>
11+
<%= display_link(n, :formal_html) %>
12+
<% if n.type? %>
13+
<span class="text-muted ml-4">
14+
[Type: <%= display_link(n.nomenclatural_type.present) %>]
15+
</span>
16+
<% end %>
17+
<% end %>
1118
<% contents.each do |k, v| %>
1219
<% render_tree_node(k, v) %>
1320
<% end %>

0 commit comments

Comments
 (0)