diff --git a/app/views/admin/pages/_show.html.erb b/app/views/admin/pages/_show.html.erb
index 1937fe92..ba9bcf48 100644
--- a/app/views/admin/pages/_show.html.erb
+++ b/app/views/admin/pages/_show.html.erb
@@ -1,3 +1,7 @@
<%= flash_messages %>
-<%= parse_page_edit(@item).html_safe %>
\ No newline at end of file
+
+<%= page_stylesheets(@item).html_safe %>
+<%= page_javascripts(@item).html_safe %>
+
+<%= parse_page_edit_noko(@item).html_safe %>
\ No newline at end of file
diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb
index 787f579b..3e641118 100644
--- a/lib/parsers/parser_back_end.rb
+++ b/lib/parsers/parser_back_end.rb
@@ -1,132 +1,86 @@
module ParserBackEnd
- require 'radius'
include ParserCommon
-
- def parse_page_edit(page)
- if page._type == 'Page'
- layout_content = page.design.layout.content.force_encoding('UTF-8') rescue ''
- context = parser_context_edit(page)
- parser = Radius::Parser.new(context, :tag_prefix => 'r')
- parser.parse(parser.parse(layout_content))
+
+ 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
+ # "#{lang}"
+ # end
+ # }.join(' | ')
+ # end
+ # c.define_tag 'link' do |tag|
+ # item = Item.first(:conditions => { :full_name => tag.attr['name'] })
+ # ret = ''
+ # ret << ""
+ # ret << item.i18n_variable[I18n.locale]
+ # ret << ""
+ # end
+
+ def parse_page_edit_noko(page, id = nil)
+ body = Nokogiri::HTML(page.design.layout.body)
+ parse_menu(body, page, true)
+ public_r_tags = parse_contents(body, page, id)
+ parse_images(body, page)
+
+ public_r_tags.each do |tag|
+ send("parse_#{tag}s", body, page,id)
end
+
+ body.to_html
end
-
- def parser_context_edit(page, attributes = {})
- Radius::Context.new do |c|
- c.define_tag 'ad_banner' do |tag|
- res = ''
- ad_banner = AdBanner.find(tag.attr["id"]) rescue nil
- if ad_banner
- res << ""
- res << "
"
- ad_banner.ad_images.each do |ad_image|
- res << ""
- end
- res << "
"
- end
- end
- c.define_tag 'content' do |tag|
- ret = ''
- if (tag.attributes["main"] == "true" && !page.module_app.nil?)
- ret << ""
- else
- part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
- ret << "
'
- case part.kind
- when 'text'
- ret << part.i18n_variable[I18n.locale] rescue ''
- when 'module_widget'
- if part[:category]
- ret << ""
- else
- ret << ""
- end
- when 'public_r_tag'
- ret << ""
- else
- ''
- end
- ret << '
'
- end
- end
- c.define_tag 'image' do |tag|
- # image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
- # image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
- image = page.design.images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
- if image
- res = "'
- end
- end
- c.define_tag 'javascripts' do |tag|
- res = ''
- res << ""
- res << ""
- res << ""
- res << ""
- page.design.javascripts.each do |js|
- res << ""
- end
- res
- end
- 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
+
+ # page_contents
+ def parse_contents(body, page, id)
+ public_r_tags = []
+ body.css('.page_content').each do |content|
+ ret = ''
+ if (content["main"] == "true" && !page.module_app.nil?)
+ ret << ""
+ else
+ part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
+ ret << "