changes in frontend rendering

This commit is contained in:
Harry Bomrah 2014-05-23 13:51:04 +08:00
parent 01219aa756
commit 3d09db0eee
2 changed files with 20 additions and 12 deletions

View File

@ -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 ? '<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" => {
"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

View File

@ -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