annotate app/helpers/application_helper.rb @ 89:d5a0d66ee457

Finish updating to rails 5
author nanaya <me@myconan.net>
date Sat, 02 Jul 2016 16:26:00 +0900
parents f91e2d00f03f
children 0c8a8b390145
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
0
a1c9fadc0904 Initial.
edogawaconan <me@myconan.net>
parents:
diff changeset
11 end