orbit-basic/lib/parsers/parser_back_end.rb

45 lines
1.3 KiB
Ruby
Raw 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='"
2012-07-30 10:34:54 +00:00
# ret << eval("admin_#{item.class.to_s.downcase}_path(item.id)")
2012-03-27 09:57:50 +00:00
# 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_edit(body, page, true)
public_r_tags = parse_contents_edit(body, page, true)
parse_images_edit(body, page)
parse_footer_edit(body, page)
parse_sub_menu_edit(body, page)
2012-12-28 02:36:18 +00:00
parse_counter_edit(body)
2012-03-27 09:57:50 +00:00
public_r_tags.each do |tag|
send("parse_#{tag}s_edit", 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