Orbit/lib/parsers/parser_back_end.rb

44 lines
1.2 KiB
Ruby
Raw Permalink Normal View History

2011-12-22 08:23:48 +00:00
module ParserBackEnd
include ParserCommon
2012-03-27 09:57:50 +00:00
require 'nokogiri'
# c.define_tag 'language_bar' do
# @site.in_use_locales.map{ |locale|
# lang = I18nVariable.first(:conditions => {:key => locale})[locale]
# if I18n.locale.to_s.eql?(locale)
# lang
# else
# "<a href='?locale=#{locale}'>#{lang}</a>"
# end
# }.join(' | ')
# end
# c.define_tag 'link' do |tag|
2012-05-11 08:16:09 +00:00
# item = Item.first(:conditions => { :path => tag.attr['name'] })
2012-03-27 09:57:50 +00:00
# ret = ''
# ret << "<a href='"
# ret << eval("admin_#{item._type.downcase}_path(item.id)")
# ret << "' class='nav'>"
# ret << item.i18n_variable[I18n.locale]
# ret << "</a>"
# end
2012-05-13 11:32:05 +00:00
def parse_page_edit_noko(page)
2012-03-27 09:57:50 +00:00
body = Nokogiri::HTML(page.design.layout.body)
parse_menu(body, page, true)
2012-05-13 11:32:05 +00:00
public_r_tags = parse_contents(body, page, true)
2012-03-27 09:57:50 +00:00
parse_images(body, page)
2012-05-13 11:32:05 +00:00
parse_footer(body, page)
parse_sub_menu(body, page)
2012-03-27 09:57:50 +00:00
public_r_tags.each do |tag|
2012-05-13 11:32:05 +00:00
send("parse_#{tag}s", body, page, true)
2011-12-22 08:23:48 +00:00
end
2012-03-27 09:57:50 +00:00
body.to_html
2011-12-22 08:23:48 +00:00
end
2012-03-27 09:57:50 +00:00
2011-12-22 08:23:48 +00:00
def self.included(base)
2012-03-27 09:57:50 +00:00
base.send :helper_method, :parse_page_edit_noko if base.respond_to? :helper_method
2011-12-22 08:23:48 +00:00
end
end