FIX: do not show image as category description
This commit is contained in:
parent
f8aca6d530
commit
fa0f731427
|
@ -393,11 +393,14 @@ class PostRevisor
|
||||||
|
|
||||||
body = @post.cooked
|
body = @post.cooked
|
||||||
matches = body.scan(/\<p\>(.*)\<\/p\>/)
|
matches = body.scan(/\<p\>(.*)\<\/p\>/)
|
||||||
if matches && matches[0] && matches[0][0]
|
|
||||||
new_description = matches[0][0]
|
matches.each do |match|
|
||||||
|
next if match[0] =~ /\<img(.*)src=/ || match[0].blank?
|
||||||
|
new_description = match[0]
|
||||||
new_description = nil if new_description == I18n.t("category.replace_paragraph")
|
new_description = nil if new_description == I18n.t("category.replace_paragraph")
|
||||||
category.update_column(:description, new_description)
|
category.update_column(:description, new_description)
|
||||||
@category_changed = category
|
@category_changed = category
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue