39 lines
1.1 KiB
Ruby
39 lines
1.1 KiB
Ruby
class AdBannersController < ApplicationController
|
|
def widget
|
|
adbanner = Banner.find(OrbitHelper.widget_custom_value)
|
|
images = adbanner.ad_images.can_display.collect.with_index do |b,i|
|
|
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>' : ""
|
|
|
|
if b.link_open == "new_window"
|
|
target = "_blank"
|
|
else
|
|
target = " "
|
|
end
|
|
|
|
{
|
|
"image_link" => image_link,
|
|
"title" => b.title,
|
|
"class" => klass,
|
|
"height" => adbanner.height,
|
|
"width" => adbanner.width,
|
|
"caption" => caption,
|
|
"context" => b.context,
|
|
"link" => b.out_link || "#",
|
|
"target" => target
|
|
}
|
|
end
|
|
{
|
|
"extras" => {
|
|
"ad_fx" => adbanner.ad_fx,
|
|
"speed" => adbanner.speed,
|
|
"title" => adbanner.title,
|
|
"timeout" => adbanner.timeout,
|
|
"more" => "More"
|
|
},
|
|
"images" => images
|
|
}
|
|
end
|
|
end
|