diff --git a/app/controllers/ad_banners_controller.rb b/app/controllers/ad_banners_controller.rb index c4f8a2a..243b2be 100644 --- a/app/controllers/ad_banners_controller.rb +++ b/app/controllers/ad_banners_controller.rb @@ -1,21 +1,29 @@ class AdBannersController < ApplicationController def widget - adbanner = Banner.first - images = adbanner.ad_images.collect do |b| - { + adbanner = Banner.find(OrbitHelper.widget_custom_value) + images = adbanner.ad_images.collect.with_index do |b,i| + klass = i == 0 ? "active" : "" + caption = i == 0 ? '
' : "" + { + "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" => { "ad_fx" => adbanner.ad_fx, - "height" => adbanner.height, - "width" => adbanner.width, "speed" => adbanner.speed, "title" => adbanner.title, "timeout" => adbanner.timeout, - "image_link" => b.file.url, "more" => "More" - } - end - { - "extras" => {}, - "data" => images + }, + "images" => images } end end diff --git a/lib/ad_banner/engine.rb b/lib/ad_banner/engine.rb index 505e96c..9c4ad6d 100644 --- a/lib/ad_banner/engine.rb +++ b/lib/ad_banner/engine.rb @@ -5,7 +5,7 @@ module AdBanner module_label "ad_banner.ad_banner" base_url File.expand_path File.dirname(__FILE__) widget_methods ["widget"] - + widget_settings [{"override_category_with"=>"banner","multiselect"=>false,"display_field"=>"title"}] taggable "Banner" categorizable authorizable