Remove i18n_variable for parser

This commit is contained in:
Christophe Vilayphiou 2012-07-26 06:02:22 +08:00
parent 5713df685d
commit 74c135f42f
1 changed files with 8 additions and 8 deletions

View File

@ -28,7 +28,7 @@ module ParserCommon
res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page)) res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page))
res << "'>" res << "'>"
root = "/" root = "/"
res << "<a href='#{edit ? root + admin_page_path(page.id) : (page._type.eql?('Page') ? root + page.path : page.url)}'><span>#{page.i18n_variable[I18n.locale]}</span></a>" res << "<a href='#{edit ? root + admin_page_path(page.id) : (page._type.eql?('Page') ? root + page.path : page.url)}'><span>#{page.title}</span></a>"
if page.visible_children.size > 0 && current < menu.levels if page.visible_children.size > 0 && current < menu.levels
res << "<span class='dot'></span>" res << "<span class='dot'></span>"
res << menu_level(page, current_page, current + 1, menu, edit) res << menu_level(page, current_page, current + 1, menu, edit)
@ -68,7 +68,7 @@ module ParserCommon
printable_ad_images.shuffle! printable_ad_images.shuffle!
printable_ad_images.each do |ad_image| #TODO Need Reflact printable_ad_images.each do |ad_image| #TODO Need Reflact
res << "<img src='#{ad_image.file}' " res << "<img src='#{ad_image.file}' "
res << "alt='#{ad_image.title[I18n.locale] || ' '}' " res << "alt='#{ad_image.title || ' '}' "
res << "time_to_next='#{ad_banner.transition_msec}' " res << "time_to_next='#{ad_banner.transition_msec}' "
res << "link_open='#{ad_image.link_open}' " 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.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
@ -116,12 +116,12 @@ module ParserCommon
res = '' res = ''
if menu_page && menu_page.visible_children.size > 0 if menu_page && menu_page.visible_children.size > 0
res << "<div class='category_list'>" res << "<div class='category_list'>"
res << "<h3 class='h3'>#{menu_page.i18n_variable[I18n.locale]}</h3>" res << "<h3 class='h3'>#{menu_page.title}</h3>"
res << "<ul class='list'>" res << "<ul class='list'>"
menu_page.visible_children.each do |child| menu_page.visible_children.each do |child|
res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>" res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>"
root = "/" root = "/"
res << "<a href='#{edit ? root + admin_page_path(child.id) : (child._type.eql?('Page') ? root + child.path : child.url)}'>#{child.i18n_variable[I18n.locale]}</a>" res << "<a href='#{edit ? root + admin_page_path(child.id) : (child._type.eql?('Page') ? root + child.path : child.url)}'>#{child.title}</a>"
res << "</li>" res << "</li>"
end end
res << "</ul>" res << "</ul>"
@ -138,7 +138,7 @@ module ParserCommon
page_footer = body.css('.page_footer').first page_footer = body.css('.page_footer').first
if page_footer if page_footer
res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>" res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>"
res << @site.footer[I18n.locale] rescue nil res << @site.footer rescue nil
res << "</div>" res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_footer.swap(fragment) rescue nil page_footer.swap(fragment) rescue nil
@ -152,7 +152,7 @@ module ParserCommon
page_sub_menu = body.css('.page_sub_menu').first page_sub_menu = body.css('.page_sub_menu').first
if page_sub_menu if page_sub_menu
res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>" res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>"
res << @site.sub_menu[I18n.locale] rescue nil res << @site.sub_menu rescue nil
res << "</div>" res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_sub_menu.swap(fragment) rescue nil page_sub_menu.swap(fragment) rescue nil
@ -175,7 +175,7 @@ module ParserCommon
ret << "'></div>" ret << "'></div>"
else else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
part_title = part.title[I18n.locale] rescue nil part_title = part.title rescue nil
if edit if edit
ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part
ret << "<div class='edit_link' style='display:none'>" ret << "<div class='edit_link' style='display:none'>"
@ -184,7 +184,7 @@ module ParserCommon
end end
case part.kind case part.kind
when 'text' when 'text'
ret << part.i18n_variable[I18n.locale] rescue '' ret << part.content rescue ''
when 'module_widget' when 'module_widget'
url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}" options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"