fix error

This commit is contained in:
chiu 2020-03-25 11:58:05 +08:00
parent 7b2c1d70d0
commit 2dec890b25
1 changed files with 3 additions and 1 deletions

View File

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