Merge branch 'ntu' of github.com:Rulingcom/orbit into ntu

This commit is contained in:
Fu Matthew committed 2012-12-28 15:31:32 +08:00
commit 5587e83419
17 files changed
+317 -50

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ module ParserBackEnd
parse_images_edit(body, page)
parse_footer_edit(body, page)
parse_sub_menu_edit(body, page)
parse_counter_edit(body)
public_r_tags.each do |tag|
send("parse_#{tag}s_edit", body, page, true)
end
+2 -2
View File
@@ -9,7 +9,7 @@ module ParserCommon
res << "'>"
i = nil
i = 1 if menu.values["li_incremental_#{current}"]
children = current == 1 ? page.visible_children.reverse : page.visible_children
children = current == 1 ? page.visible_children : page.visible_children
children.each do |child|
res << menu_li(child, current_page, current, menu, i, edit)
i += 1 if i
@@ -233,7 +233,7 @@ module ParserCommon
end
# page_counter
def parse_counter(body = nil, page = nil, edit=nil)
def parse_counter_edit(body = nil)
body.css('.page_counter').each do |counter|
res = ''
case counter['option']
+29 -4
View File
@@ -11,6 +11,7 @@ module ParserFrontEnd
parse_images(body, page)
parse_menu(body, page)
parse_sub_menu(body, page, site)
parse_counter(body)
i18n.merge!({locale => body.to_html})
end
i18n
@@ -21,10 +22,14 @@ module ParserFrontEnd
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
body = Nokogiri::HTML(page.content)
body.css('orbit_front').each do |front|
ret = ''
part = PagePart.find(front['part_id']) if front['part_id']
ret << eval("\"#{front['path']}\"") rescue ''
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
if front['value']
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>#{eval(front['value']).to_s}</div>")
else
ret = ''
part = PagePart.find(front['part_id']) if front['part_id']
ret << eval("\"#{front['path']}\"") rescue ''
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
end
front.swap(fragment)
end
body.to_html
@@ -130,6 +135,26 @@ module ParserFrontEnd
end
end
def parse_counter(body = nil)
body.css('.page_counter').each do |counter|
ret = ''
case counter['option']
when 'all'
ret << "display_visitors"
when 'today'
ret << "display_visitors_today"
when 'this_week'
ret << "display_visitors_this_week"
when 'this_month'
ret << "display_visitors_this_month"
when 'this_year'
ret << "display_visitors_this_year"
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<orbit_front id='#{counter['id']}' class='#{counter['class']}' value='#{ret}'></orbit_front>")
counter.swap(fragment)
end
end
# ad_banners
def generate_ad_banners(*args)
"<div class='dymanic_load' path='#{front_show_banner_path(args[0])}'></div>"