Skip to content

Commit a2d5106

Browse files
committed
improve: 長いURLを30文字で切り詰めて表示(Railsのtruncateヘルパー使用)
- Railsのtruncateヘルパーメソッドを使用 - 30文字を超えるURLは「...」で省略表示 - title属性で完全なURLをツールチップ表示 - リンク先は完全なURLを維持
1 parent a0d34fb commit a2d5106

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/views/dojos/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<small>
130130
<a href='<%= dojo[:url] %>'>
131131
<span title="<%= dojo[:url] %>">
132-
<%= CGI.unescape dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/') %>
132+
<%= truncate(CGI.unescape(dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/')), length: 30) %>
133133
</span>
134134
</a>
135135
</small>
@@ -150,7 +150,7 @@
150150
<small>
151151
<a href='<%= dojo[:url] %>'>
152152
<span title="<%= dojo[:url] %>">
153-
<%= CGI.unescape dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/') %>
153+
<%= truncate(CGI.unescape(dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/')), length: 30) %>
154154
</span>
155155
</a>
156156
</small>

0 commit comments

Comments
 (0)