conred 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/conred/helpers.rb +5 -5
- data/lib/conred/version.rb +1 -1
- metadata +1 -1
data/lib/conred/helpers.rb
CHANGED
@@ -5,20 +5,20 @@ module Conred
|
|
5
5
|
module Helpers
|
6
6
|
|
7
7
|
extend self
|
8
|
-
|
9
|
-
|
8
|
+
mattr_accessor :action_view
|
9
|
+
self.action_view = ActionView::Base.new
|
10
10
|
|
11
11
|
def sanitize_and_trim(text, word_count = nil, omission = '...')
|
12
|
-
text =
|
12
|
+
text = action_view.strip_tags(text)
|
13
13
|
if word_count
|
14
|
-
|
14
|
+
action_view.truncate(text, :length => word_count, :omission => omission)
|
15
15
|
else
|
16
16
|
text
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def sanitize_body(text)
|
21
|
-
text =
|
21
|
+
text = action_view.sanitize(text, :tags => %w(p a strong ul ol li blockquote strike u em), :attributes => %w(href))
|
22
22
|
text.html_safe
|
23
23
|
end
|
24
24
|
|
data/lib/conred/version.rb
CHANGED