Skip to content

Commit 5af742d

Browse files
committed
Show Dojo tags as tooltip of '...' for ones more than 5th
1 parent ee3e51e commit 5af742d

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/views/shared/_dojo.html.erb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,34 @@
55
<span class="dojo-name">
66
<%= link_to "#{dojo.name} (#{dojo.prefecture.name})", dojo.url, target: "_blank", rel: "external noopener" %>
77
<% if not dojo.counter == 1 %>
8-
<span class="dojo-counter" data-original-title="道場数"
8+
<span class="dojo-counter"
9+
data-original-title="道場数"
910
data-placement="bottom"
1011
data-toggle="tooltip"><%= dojo.counter %></span>
1112
<% end %>
1213
</span>
1314
</header>
15+
1416
<ul class="tags">
15-
<% dojo.tags.each do |tag| %>
17+
<% dojo.tags.first(5).each do |tag| %>
1618
<li><%= tag %></li>
1719
<% end %>
20+
21+
<% if dojo.tags.drop(5).any? %>
22+
<li class="tags-more"
23+
data-toggle="tooltip"
24+
data-placement="bottom"
25+
data-html="true"
26+
title="<%= dojo.tags[5..].join(', ') %>">
27+
...
28+
</li>
29+
<% end %>
1830
</ul>
31+
1932
<p class="dojo-description">
2033
<%= dojo.description %>
2134
<% if dojo.is_private %>
2235
<%= link_to 'Private', doc_path('private-dojo'), class: 'dojo-private' %>
2336
<% end %>
2437
</p>
25-
</li>
38+
</li>

0 commit comments

Comments
 (0)