- Widgets for announcement
  - Facebook link
  - AdBanner nav
This commit is contained in:
chris committed 2012-11-21 18:42:14 +08:00
1 parent bfa6579aad
commit 2d0e8b37b2
5 files changed
+35 -12

No files matched your search

+25 -2
View File
@@ -54,7 +54,7 @@ module ParserCommon
delay: -1000,
fx: '#{ad_banner.ad_fx.nil? ? 'fade': ad_banner.ad_fx}',
timeoutFn: getTimeout,
pager: '#banner_nav',
pager: '.banner_nav-#{ad_banner.title.dehumanize}',
pagerAnchorBuilder: function(idx, slide) {
return \"<li><a href='#'></a></li>\";
}
@@ -62,7 +62,8 @@ module ParserCommon
};
});
</script>"
res << "<ul id='banner_nav' class='clear'></ul>"
res << "<div style='position:relative'>"
res << "<ul id='banner_nav' class='clear banner_nav-#{ad_banner.title.dehumanize}'></ul>"
res << "<div id='slideshow-#{ad_banner.title.dehumanize}' class='slideshow'>"
printable_ad_images = []
ad_banner.ad_images.each do |ad_image|
@@ -84,6 +85,7 @@ module ParserCommon
res << "style='#{'display:none;' if hide} #{'cursor:pointer;' if !ad_image.out_link.blank?}'"
res << "/>"
end
res << "</div>"
res << "</div>"
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
@@ -234,4 +236,25 @@ module ParserCommon
public_r_tags.uniq
end
# page_counter
def parse_counter(body = nil, page = nil, edit=nil)
body.css('.page_counter').each do |counter|
res = ''
case counter['option']
when 'all'
res << display_visitors.to_s
when 'today'
res << display_visitors_today.to_s
when 'this_week'
res << display_visitors_this_week.to_s
when 'this_month'
res << display_visitors_this_month.to_s
when 'this_year'
res << display_visitors_this_year.to_s
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
counter.swap(fragment)
end
end
end