FIX: clean html before sending it to jquery for collapsing

This commit is contained in:
Sam 2015-05-20 14:42:54 +10:00
parent 8be746b285
commit 8013b6a511
3 changed files with 8 additions and 12 deletions

View File

@ -47,7 +47,7 @@
<b>{{i18n 'user.suspended_reason'}}</b> {{user.suspend_reason}}
</div>
{{else}}
{{#if user.bio_cooked}}<div class='bio'>{{text-overflow class="overflow" text=user.bio_cooked}}</div>{{/if}}
{{#if user.bio_cooked}}<div class='bio'>{{text-overflow class="overflow" text=user.bio_excerpt}}</div>{{/if}}
{{/if}}
{{#if user.card_badge}}

View File

@ -196,16 +196,7 @@ class UserSerializer < BasicUserSerializer
end
def bio_excerpt
# If they have a bio return it
excerpt = object.user_profile.bio_excerpt
return excerpt if excerpt.present?
# Without a bio, determine what message to show
if scope.user && scope.user.id == object.id
I18n.t('user_profile.no_info_me', username_lower: object.username_lower)
else
I18n.t('user_profile.no_info_other', name: object.name)
end
object.user_profile.bio_excerpt(350 ,keep_newlines: true)
end
def include_suspend_reason?

View File

@ -12,6 +12,7 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
@strip_links = options[:strip_links] == true
@text_entities = options[:text_entities] == true
@markdown_images = options[:markdown_images] == true
@keep_newlines = options[:keep_newlines] == true
@start_excerpt = false
end
@ -92,7 +93,11 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
@in_a = false
end
when "p", "br"
characters(" ")
if @keep_newlines
characters("<br>", false, false, false)
else
characters(" ")
end
when "aside"
@in_quote = false
when "div", "span"