annotate app/helpers/application_helper.rb @ 96:148d8c17cb79

Less monkeypatching rails, more monkeypatching tweet
author nanaya <me@myconan.net>
date Thu, 28 Jul 2016 04:25:47 +0900
parents 0c8a8b390145
children c5c095f6981e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a1c9fadc0904 Initial.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 module ApplicationHelper
15
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents: 0
diff changeset
2 include Twitter::Autolink
80
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
3
82
f91e2d00f03f Reduce title length limit
nanaya <me@myconan.net>
parents: 80
diff changeset
4 def ellipsize(text, limit = 30)
80
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
5 if text.length <= limit
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
6 text
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
7 else
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
8 "#{text.first(limit)}..."
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
9 end
448a368f7344 More useful title?
nanaya <me@myconan.net>
parents: 15
diff changeset
10 end
94
0c8a8b390145 Now with epic caching
nanaya <me@myconan.net>
parents: 82
diff changeset
11
0c8a8b390145 Now with epic caching
nanaya <me@myconan.net>
parents: 82
diff changeset
12 def atom_id(id)
0c8a8b390145 Now with epic caching
nanaya <me@myconan.net>
parents: 82
diff changeset
13 "tag:#{request.host_with_port},2005:#{id}"
0c8a8b390145 Now with epic caching
nanaya <me@myconan.net>
parents: 82
diff changeset
14 end
0
a1c9fadc0904 Initial.
edogawaconan <me@myconan.net>
parents:
diff changeset
15 end