adbanner-test/app/controllers/ad_banners_controller.rb

30 lines
867 B
Ruby
Raw Normal View History

2014-04-11 07:47:33 +00:00
class AdBannersController < ApplicationController
def widget
2014-05-23 05:51:04 +00:00
adbanner = Banner.find(OrbitHelper.widget_custom_value)
images = adbanner.ad_images.collect.with_index do |b,i|
klass = i == 0 ? "active" : ""
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
{
"image_link" => b.file.url,
"title" => b.title,
"class" => klass,
"height" => adbanner.height,
"width" => adbanner.width,
"caption" => caption,
"context" => b.context,
"link" => b.out_link || "#"
}
end
{
"extras" => {
2014-04-15 07:51:02 +00:00
"ad_fx" => adbanner.ad_fx,
"speed" => adbanner.speed,
"title" => adbanner.title,
"timeout" => adbanner.timeout,
2014-04-11 07:47:33 +00:00
"more" => "More"
2014-05-23 05:51:04 +00:00
},
"images" => images
2014-04-11 07:47:33 +00:00
}
end
end