FIX: remove meta data from lightbox in both excerpt (html & text)

This commit is contained in:
Régis Hanol
2014-11-05 20:37:00 +01:00
parent e79c1c23d9
commit a5616146eb
5 changed files with 20 additions and 27 deletions

View File

@ -1,13 +1,5 @@
module UserNotificationsHelper
def self.sanitize_options
return @sanitize_options if @sanitize_options
@sanitize_options = Sanitize::Config::RELAXED.deep_dup
@sanitize_options[:elements] << 'aside' << 'div'
@sanitize_options[:attributes][:all] << 'class'
@sanitize_options
end
def indent(text, by=2)
spacer = " " * by
result = ""
@ -57,21 +49,15 @@ module UserNotificationsHelper
end
def email_excerpt(html, posts_count)
# If there's only one post, include the whole thing.
if posts_count == 1
raw Sanitize.clean(html, UserNotificationsHelper.sanitize_options)
else
# Otherwise, try just the first paragraph.
para = first_paragraph_from(html)
raw Sanitize.clean(para.to_s, UserNotificationsHelper.sanitize_options)
end
# only include 1st paragraph when more than 1 posts
html = first_paragraph_from(html).to_s if posts_count > 1
raw format_for_email(html)
end
def cooked_post_for_email(post)
PrettyText.format_for_email(post.cooked).html_safe
def format_for_email(html)
PrettyText.format_for_email(html).html_safe
end
def email_category(category, opts=nil)
opts = opts || {}