include ad_banner query code. cleaned up parser
This commit is contained in:
parent
436f039c1b
commit
8ef2d4b02e
|
@ -68,6 +68,7 @@ module ParserBackEnd
|
|||
c.define_tag 'javascripts' do |tag|
|
||||
res = ''
|
||||
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
|
||||
res << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>"
|
||||
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
|
||||
page.design.javascripts.each do |js|
|
||||
res << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||
|
@ -75,23 +76,25 @@ module ParserBackEnd
|
|||
res
|
||||
end
|
||||
c.define_tag 'adbanner' do |tag|
|
||||
ret = ''
|
||||
res = ''
|
||||
ad_banner = AdBanner.first(conditions:{title: tag.attr["name"]})
|
||||
ret << "<script type='text/javascript' src='http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js'></script>"
|
||||
ret << "<script type='text/javascript'> $(document).ready(function() { $('.slideshow').cycle({ fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}' }); }); </script>"
|
||||
res << "<script type='text/javascript'>
|
||||
$(document).ready(function(){ $('#slideshow-#{ad_banner.title}').cycle({after: onAfter,timeout:1 ,fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}' }); });
|
||||
</script>"
|
||||
|
||||
|
||||
ret << "<div id='#{tag.attr['name']}' ad_banner_id='#{ad_banner.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"
|
||||
ret << "<div class='edit_link' style='display:none'>"
|
||||
ret << " <a href='#{edit_admin_ad_banner_path(ad_banner.id)}' class='nav'>#{t(:edit)}</a>"
|
||||
ret << '</div>'
|
||||
res << "<div id='#{tag.attr['name']}' ad_banner_id='#{ad_banner.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"
|
||||
res << "<div class='edit_link' style='display:none'>"
|
||||
res << " <a href='#{edit_admin_ad_banner_path(ad_banner.id)}' class='nav'>#{t(:edit)}</a>"
|
||||
res << '</div>'
|
||||
#==================================
|
||||
ret << "<div class='slideshow'>"
|
||||
res << "<div id='slideshow-#{ad_banner.title}'>"
|
||||
ad_banner.ad_images.each do |ad_image|
|
||||
ret << "<img src='#{ad_image.file}' />"
|
||||
res << "<img src='#{ad_image.file}' />"
|
||||
end
|
||||
ret << "</div>"
|
||||
res << "</div>"
|
||||
#==================================
|
||||
ret << "</div>"
|
||||
res << "</div>"
|
||||
end
|
||||
c.define_tag 'layout_part' do |tag|
|
||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
||||
|
|
|
@ -76,6 +76,7 @@ module ParserFrontEnd
|
|||
c.define_tag 'javascripts' do |tag|
|
||||
res = ''
|
||||
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
|
||||
res << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>"
|
||||
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
|
||||
page.design.javascripts.each do |js|
|
||||
res << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||
|
@ -86,16 +87,11 @@ module ParserFrontEnd
|
|||
res = ''
|
||||
ad_banner = AdBanner.first(conditions:{title: tag.attr["name"]})
|
||||
if ad_banner.display?
|
||||
res << "<script type='text/javascript' src='http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js'></script>"
|
||||
res << "<script type='text/javascript'>function onAfter(e) {
|
||||
var parent = $(this).parent();
|
||||
var time_to_next = $(this).attr('time_to_next');
|
||||
parent.cycle('pause');
|
||||
setTimeout(function(){parent.cycle('resume')},time_to_next);
|
||||
res << "<script type='text/javascript'>
|
||||
$(document).ready(function(){ $('#slideshow-#{ad_banner.title}').cycle({after: onAfter,timeout:1 ,fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}' }); });
|
||||
</script>"
|
||||
|
||||
} $(document).ready(function() { $('.slideshow').cycle({after: onAfter,timeout:1 ,fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}' }).children('img').click(function(){if($(this).attr('link_open')=='new_window'){window.open($(this).attr('link_url'));} else{document.location.href=$(this).attr('link_url');}});; }); </script>"
|
||||
|
||||
res << "<div class='slideshow'>"
|
||||
res << "<div id='slideshow-#{ad_banner.title}'>"
|
||||
ad_banner.ad_images.each do |ad_image|
|
||||
res << "<img src='#{ad_image.file}' "
|
||||
res << "alt='#{ad_image.picture_intro || ' '}' "
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,4 +17,25 @@ function ajax_load_proc(wapper,url){
|
|||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed");
|
||||
});
|
||||
}
|
||||
}
|
||||
// Ad Banner FX code [start]
|
||||
function onAfter(e) {
|
||||
var parent = $(this).parent();
|
||||
var time_to_next = $(this).attr('time_to_next');
|
||||
parent.cycle('pause');
|
||||
setTimeout(function(){parent.cycle('resume')},time_to_next);
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('.slideshow').children('img').click(function()
|
||||
{
|
||||
if($(this).attr('link_open')=='new_window')
|
||||
{
|
||||
window.open($(this).attr('link_url'));
|
||||
}
|
||||
else
|
||||
{
|
||||
document.location.href=$(this).attr('link_url')
|
||||
}
|
||||
})
|
||||
});
|
||||
// Ad Banner FX code [end]
|
Loading…
Reference in New Issue