Escape quote in title.
This commit is contained in:
parent
7b9727c501
commit
ac2c08767f
|
@ -22,7 +22,9 @@ class AdBannersController < ApplicationController
|
|||
image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url
|
||||
klass = i == 0 ? "active" : ""
|
||||
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
|
||||
alt_title = (b.title.nil? || b.title == "" ? "ad-banner image" : b.title)
|
||||
banner_title = b.title.to_s
|
||||
banner_title_escape = banner_title.gsub('"','"')
|
||||
alt_title = (banner_title_escape.blank? ? "Banner image" : banner_title_escape)
|
||||
|
||||
if b.link_open == "new_window"
|
||||
target = "_blank"
|
||||
|
@ -36,8 +38,8 @@ class AdBannersController < ApplicationController
|
|||
images << {
|
||||
"slide_number" => (i+1),
|
||||
"image_link" => image_link,
|
||||
"image_alt" => "ad banner image",
|
||||
"title" => b.title,
|
||||
"image_alt" => "Banner image",
|
||||
"title" => banner_title_escape,
|
||||
"alt_title" => alt_title,
|
||||
"class" => klass,
|
||||
"height" => adbanner.height,
|
||||
|
@ -55,7 +57,7 @@ class AdBannersController < ApplicationController
|
|||
"extras" => {
|
||||
"ad_fx" => adbanner.ad_fx,
|
||||
"speed" => adbanner.speed,
|
||||
"title" => adbanner.title,
|
||||
"title" => adbanner.title.to_s.gsub('"','"'),
|
||||
"banner-height" => adbanner.height,
|
||||
"banner-width" => adbanner.width,
|
||||
"base_image" => (base_image - 1),
|
||||
|
@ -76,7 +78,6 @@ class AdBannersController < ApplicationController
|
|||
adbanner.ad_images.can_display.asc(:sort_number).each_with_index do |ad_b,i|
|
||||
if ad_b.language_enabled.include?(I18n.locale.to_s)
|
||||
image_link = OrbitHelper.is_mobile_view ? ad_b.file.mobile.url : ad_b.file.url
|
||||
alt_text = (ad_b.title.nil? || ad_b.title == "" ? "ad-banner image" : ad_b.title)
|
||||
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
|
||||
klass = i == 0 ? "active" : ""
|
||||
if ad_b.link_open == "new_window"
|
||||
|
@ -85,31 +86,33 @@ class AdBannersController < ApplicationController
|
|||
target = ""
|
||||
end
|
||||
context = ad_b.context.tr('"',"'") rescue ""
|
||||
alt_title = (ad_b.title.blank? ? "ad-banner image" : ad_b.title)
|
||||
banner_title = ad_b.title.to_s
|
||||
banner_title_escape = banner_title.gsub('"','"')
|
||||
alt_title = (banner_title_escape.blank? ? "Banner image" : banner_title_escape)
|
||||
if ad_b.exchange_item == "1"
|
||||
image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass}\"
|
||||
data-link=\"#{ad_b.out_link || "#"}\"
|
||||
data-cycle-title=\"#{ad_b.title}\"
|
||||
data-cycle-title=\"#{banner_title_escape}\"
|
||||
data-cycle-desc=\"#{context}\"
|
||||
data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\"
|
||||
data-overlay-template=\"<h3>#{banner_title_escape}</h3><p>#{context}</p>\"
|
||||
data-target=\"#{target}\"
|
||||
>
|
||||
<a href=\"#{ad_b.out_link}\" target=\"#{target}\" title=\"#{alt_title}\">
|
||||
<img class='w-ad-banner__image' src='#{image_link}'>
|
||||
</a>
|
||||
<div class='w-ad-banner__caption_text'>#{ad_b.title}</div>
|
||||
<div class='w-ad-banner__caption_text'>#{banner_title}</div>
|
||||
</div>"
|
||||
elsif ad_b.exchange_item == "3"
|
||||
klass = (i == 0 ? "active" : "")
|
||||
video_url = ad_b.video_file.url rescue nil
|
||||
video_webm_url = ad_b.video_file_webm.url rescue nil
|
||||
@file_poster = ad_b.video_snapshot.url rescue nil
|
||||
title = (ad_b.title.blank? ? File.basename(video_url) : ad_b.title)
|
||||
title = (banner_title.blank? ? File.basename(video_url) : banner_title)
|
||||
image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass} jplayer_slide\"
|
||||
data-link=\"#{ad_b.out_link || "#"}\"
|
||||
data-cycle-title=\"#{ad_b.title}\"
|
||||
data-cycle-title=\"#{banner_title_escape}\"
|
||||
data-cycle-desc=\"#{context}\"
|
||||
data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\"
|
||||
data-overlay-template=\"<h3>#{banner_title_escape}</h3><p>#{context}</p>\"
|
||||
data-target=\"#{target}\"
|
||||
style=\"height: 100%;\"
|
||||
data-autoplay=\"#{@autoplay_video}\"
|
||||
|
@ -123,9 +126,9 @@ class AdBannersController < ApplicationController
|
|||
data-yt-binded=\"0\"
|
||||
data-youtube-id=\"ytplayer#{i}\"
|
||||
data-link=\"#{ad_b.out_link || "#"}\"
|
||||
data-cycle-title=\"#{ad_b.title}\"
|
||||
data-cycle-title=\"#{banner_title_escape}\"
|
||||
data-cycle-desc=\"#{context}\"
|
||||
data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\"
|
||||
data-overlay-template=\"<h3>#{banner_title_escape}</h3><p>#{context}</p>\"
|
||||
data-target=\"#{target}\"
|
||||
data-autoplay=\"#{@autoplay_video}\"
|
||||
>
|
||||
|
@ -152,15 +155,16 @@ class AdBannersController < ApplicationController
|
|||
extra_after_html = ActionController::Base.helpers.javascript_include_tag("banner/jquery.jplayer.min.js")
|
||||
end
|
||||
base_image = adbanner.base_image.nil? ? 1 : adbanner.base_image
|
||||
adbanner_title_escape = adbanner.title.to_s.gsub('"','"')
|
||||
{
|
||||
"extras" => {
|
||||
"ad_fx" => adbanner.ad_fx,
|
||||
"speed" => adbanner.speed,
|
||||
"title" => adbanner.title,
|
||||
"title" => adbanner_title_escape,
|
||||
"base_image" => (base_image - 1),
|
||||
"timeout" => (adbanner.timeout * 1000),
|
||||
"more" => "More",
|
||||
"desc" => adbanner.title,
|
||||
"desc" => adbanner_title_escape,
|
||||
"extra_before_html" => extra_before_html,
|
||||
"extra_after_html" => extra_after_html,
|
||||
"extra_ready_script" => "if (i == 0 && banner_wrap.find('.w-ad-banner__slide').index($(iframe).parents('.w-ad-banner__slide').eq(0))==0 && banner_wrap.find('[data-autoplay=1]').length != 0){
|
||||
|
|
Loading…
Reference in New Issue