The new AdBanner.
This commit is contained in:
1 parent
b17cd7570f
commit
8f28d45379
32 files changed
+1763
-240
No files matched your search
@@ -1,2 +1,34 @@
|
||||
module Admin::AdBannerHelper
|
||||
def preview_block(ad_banner)
|
||||
res =''
|
||||
#same code as in frontend backend parser
|
||||
if ad_banner
|
||||
res << "<script type='text/javascript'>
|
||||
$(document).ready(function(){ $('#slideshow-#{ad_banner.title.dehumanize}').cycle({delay: -1000, fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}', timeoutFn: getTimeout }); });
|
||||
</script>"
|
||||
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
|
||||
printable_ad_images = []
|
||||
ad_banner.ad_images.each do |ad_image|
|
||||
if ad_image.display?
|
||||
ad_image.weight.times do
|
||||
printable_ad_images << ad_image
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printable_ad_images.shuffle!
|
||||
printable_ad_images.each do |ad_image| #TODO Need Reflact
|
||||
res << "<img src='#{ad_image.file}' "
|
||||
res << "alt='#{ad_image.title || ' '}' "
|
||||
res << "time_to_next='#{ad_banner.transition_sec}' "
|
||||
res << "link_open='#{ad_image.link_open}' "
|
||||
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
|
||||
res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' "
|
||||
res << "/>"
|
||||
end
|
||||
res << "</div>"
|
||||
res.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
module Admin::AdImagesHelper
|
||||
|
||||
def active_when_default_locale_eq locale
|
||||
locale.to_sym == I18n.default_locale ? 'active': ''
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,6 +2,12 @@ module ApplicationHelper
|
||||
|
||||
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
||||
|
||||
def site_valid_locales_default_head
|
||||
index = @site_valid_locales.rindex I18n.default_locale.to_s
|
||||
shift_out = @site_valid_locales.shift(index)
|
||||
@site_valid_locales += shift_out
|
||||
end
|
||||
|
||||
def colorize_in_use_locale(locale)
|
||||
@site_in_use_locales.include?(locale)? 'green' : 'red'
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user