class AdBannersController < ApplicationController def widget adbanner = Banner.find(OrbitHelper.widget_custom_value) images = [] adbanner.ad_images.can_display.asc(:sort_number,:created_at).each.with_index do |b,i| if b.language_enabled.include?(I18n.locale.to_s) image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url klass = i == 0 ? "active" : "" caption = i == 0 ? '
' : "" alt_title = (b.title.nil? || b.title == "" ? "ad-banner image" : b.title) if b.link_open == "new_window" target = "_blank" else target = "" end images << { "image_link" => image_link, "image_alt" => "ad banner image", "title" => b.title, "alt_title" => alt_title, "class" => klass, "height" => adbanner.height, "width" => adbanner.width, "caption" => caption, "context" => (b.context.tr('"',"'") rescue ""), "link" => b.out_link || "#", "target" => target } end end base_image = adbanner.base_image.nil? ? 1 : adbanner.base_image { "extras" => { "ad_fx" => adbanner.ad_fx, "speed" => adbanner.speed, "title" => adbanner.title, "banner-height" => adbanner.height, "banner-width" => adbanner.width, "base_image" => (base_image - 1), "timeout" => (adbanner.timeout * 1000), "more" => "More" }, "images" => images } end end