Remove rich_title font-size style in show page.

This commit is contained in:
BOHUNG 2020-03-20 15:44:21 +08:00
parent 2e5682dade
commit c24045e420
1 changed files with 5 additions and 1 deletions

View File

@ -43,8 +43,12 @@ class FaqsController < ApplicationController
}
end
tags = faq.tags.map{|tag| { "tag" => tag.name } } rescue []
temp_rich_title = Nokogiri::HTML(faq.rich_title).css('body')
temp_rich_title.children.each_with_index do |child,i|
temp_rich_title.children[i].attribute('style').value = child.attribute('style').value.gsub(/\b(?:font-size\s*?:\s*([^;>]*?)(?=[;">}]))/,'')
end
{
"extras" => {"question" => faq.title,"answer" => faq.answer},
"extras" => {"question" => temp_rich_title,"answer" => faq.answer},
"faqs_links" => faqs_links,
"faqs_files" => faqs_files,
"tags" => tags,