Update text_marquees_controller.rb

fix error create title for img tag
This commit is contained in:
chiu 2019-09-07 16:12:10 +08:00
parent 1b9914dcf8
commit ea315a7f89
1 changed files with 1 additions and 5 deletions

View File

@ -4,11 +4,7 @@ class TextMarqueesController < ApplicationController
marquee = Marquee.find(OrbitHelper.widget_custom_value) marquee = Marquee.find(OrbitHelper.widget_custom_value)
texts = marquee.marquee_texts.collect do |mqt| texts = marquee.marquee_texts.collect do |mqt|
doc = Nokogiri::HTML(mqt.title) doc = Nokogiri::HTML(mqt.title)
if mqt.title.to_s.empty? title = doc.text.empty? ? 'no content' : doc.text
title = 'no content'
else
title = doc.css('span').text.empty? ? mqt.title : doc.css('span').text
end
{ {
"text" => mqt.title, "text" => mqt.title,
"speed" => mqt.speed, "speed" => mqt.speed,