diff --git a/app/controllers/ad_banners_controller.rb b/app/controllers/ad_banners_controller.rb index 19c2993..9c35414 100644 --- a/app/controllers/ad_banners_controller.rb +++ b/app/controllers/ad_banners_controller.rb @@ -1,7 +1,9 @@ class AdBannersController < ApplicationController def self.custom_widget_data ac = ActionController::Base.new - ac.render_to_string("ad_banners/custom_widget_data",:locals=>{:@custom_data_field=>@custom_data_field,:@field_name=>@field_name}) + ac.instance_variable_set(:@custom_data_field, @custom_data_field) + ac.instance_variable_set(:@field_name, @field_name) + ac.render_to_string("ad_banners/custom_widget_data") end def widget adbanner = Banner.find(OrbitHelper.widget_custom_value) @@ -71,8 +73,9 @@ class AdBannersController < ApplicationController def video_widget(adbanner) subpart = OrbitHelper.get_current_widget custom_data_field = subpart.custom_data_field || {} - @autoplay_video = custom_data_field[:autoplay_video] rescue "0" - @hide_video_tools = custom_data_field[:hide_video_tools] == "1" rescue false + data_autoplay = custom_data_field[:autoplay_video] rescue "0" + @is_autoplay_video = (data_autoplay == "1") + @hide_video_tools = (custom_data_field[:hide_video_tools] == "1" rescue false) images = [] has_jplayer = false adbanner.ad_images.can_display.asc(:sort_number).each_with_index do |ad_b,i| @@ -108,6 +111,9 @@ class AdBannersController < ApplicationController video_webm_url = ad_b.video_file_webm.url rescue nil @file_poster = ad_b.video_snapshot.url rescue nil title = (banner_title.blank? ? File.basename(video_url) : banner_title) + @autoplay_video = (@is_autoplay_video && i == 0) + @apply_autoplay_script = @is_autoplay_video + @is_frontend = true image_html = "
" has_jplayer = true elsif ad_b.exchange_item == "2" @@ -130,7 +136,7 @@ class AdBannersController < ApplicationController data-cycle-desc=\"#{context}\" data-overlay-template=\"#{context}
\" data-target=\"#{target}\" - data-autoplay=\"#{@autoplay_video}\" + data-autoplay=\"#{data_autoplay}\" >