Skip to content

Commit 7c6ec10

Browse files
committed
Update _taxonomy.html.erb
1 parent 23239d0 commit 7c6ec10

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

app/views/names/_taxonomy.html.erb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,21 @@
137137

138138
<% unless @name.children.empty? %>
139139
<dt><%= fa_icon('sort-amount-down-alt') %> Children
140-
<span class="text-muted">(<%= @name.children.count %>)</span><dt>
140+
<span class="text-muted" id="name-<%= @name.id %>-children-count">(<%=
141+
@name.children.count %>)</span><dt>
141142
<dd>
142143
<% if @name.children.length >= 12 %>
143144
<div id="name-<%= @name.id %>-children-filter">
144-
<% { validated: 'non-validly published', correct: 'incorrect'
145-
}.each do |feat, txt| %>
145+
<% {
146+
validated: 'non-validly published',
147+
correct: 'validly published but incorrect'
148+
}.each do |feat, txt| %>
146149
<%= link_to('#',
147-
class: 'badge badge-pill badge-primary mr-2',
150+
class: 'badge badge-pill badge-primary mr-1',
148151
data: { feat: feat, visible: true, name: @name.id }
149152
) do %>
150-
<%= fa_icon('eye-slash') %> <span>Hide</span> <%= txt %> names
153+
<%= fa_icon('eye-slash', class: 'mr-2') %>
154+
<span>Hide</span> <%= txt %> names
151155
<% end %>
152156
<% end %>
153157
</div>
@@ -163,17 +167,21 @@
163167
);
164168
if (btn.data("visible")) {
165169
children.hide(400);
170+
children.data("visible", false);
166171
btn.data("visible", false);
167172
btn.find("span").html("Show");
168173
btn.find("i").removeClass("fa-eye-slash");
169174
btn.find("i").addClass("fa-eye");
170175
} else {
171176
children.show(400);
177+
children.data("visible", true);
172178
btn.data("visible", true);
173179
btn.find("span").html("Hide");
174180
btn.find("i").removeClass("fa-eye");
175181
btn.find("i").addClass("fa-eye-slash");
176182
}
183+
visible = $(`ul#name-${name_id}-children li[data-visible=true]`);
184+
$(`#name-${name_id}-children-count`).html(`(${visible.length})`);
177185
return false;
178186
});
179187
});

0 commit comments

Comments
 (0)