comparison app/helpers/application_helper.rb @ 172:df4be896ab8b

Improved escaping and truncating
author nanaya <me@nanaya.pro>
date Wed, 08 Aug 2018 20:37:29 +0900
parents 90db232f39e7
children 52252ae4b580
comparison
equal deleted inserted replaced
171:90db232f39e7 172:df4be896ab8b
1 module ApplicationHelper 1 module ApplicationHelper
2 include Twitter::TwitterText::Autolink 2 include Twitter::TwitterText::Autolink
3
4 def ellipsize(text, limit = 30)
5 if text.length <= limit
6 text
7 else
8 "#{text.first(limit)}..."
9 end
10 end
11 3
12 def atom_id(id) 4 def atom_id(id)
13 "tag:#{request.host},2005:#{id}" 5 "tag:#{request.host},2005:#{id}"
14 end 6 end
15 7