Commit eae4963440302f73e5dadbf5fa13fd574104f81f

Authored by Andrey Karpikov
1 parent 70143114

check p

@@ -100,6 +100,7 @@ module Kanjai @@ -100,6 +100,7 @@ module Kanjai
100 end 100 end
101 end 101 end
102 session[:url] = @url 102 session[:url] = @url
  103 + session[:current_page_id] = @page_data.page.id
103 end 104 end
104 105
105 106
@@ -12,7 +12,19 @@ module Kanjai @@ -12,7 +12,19 @@ module Kanjai
12 12
13 Nokogiri::HTML::Builder.with(@doc) do |subparts| 13 Nokogiri::HTML::Builder.with(@doc) do |subparts|
14 @repeat_type_index = {} 14 @repeat_type_index = {}
15 - TemplateGenerator.method("#{type}_generator").call(session, domain, elements, subparts, @original_hash_value[0]) 15 + if type == "subMenuTemplate"
  16 + type = "menu"
  17 + current_page = nil
  18 + if session[:current_page_id]
  19 + current_page = Kanjai::Page.find_by_id(session[:current_page_id])
  20 + while current_page && current_page.parent && current_page.page_template == current_page.parent.page_template
  21 + current_page = current_page.parent
  22 + end
  23 + end
  24 + TemplateGenerator.method("#{type}_generator").call(session, domain, elements, subparts, @original_hash_value[0], current_page)
  25 + else
  26 + TemplateGenerator.method("#{type}_generator").call(session, domain, elements, subparts, @original_hash_value[0])
  27 + end
16 end 28 end
17 29
18 @doc.css("img[@src]").each do |x| 30 @doc.css("img[@src]").each do |x|
@@ -32,10 +44,10 @@ module Kanjai @@ -32,10 +44,10 @@ module Kanjai
32 case item[:name] 44 case item[:name]
33 when 'text' 45 when 'text'
34 content = item[:source] 46 content = item[:source]
35 - if current_page  
36 - content = content.gsub('###link###', current_page.menu_url('http://', lang = nil))  
37 - .gsub('###title###', current_page.lang_attributes(domain.page_langs.default, :title))  
38 - end 47 + #if current_page
  48 + # content = content.gsub('###link###', current_page.menu_url('http://', lang = nil))
  49 + # .gsub('###title###', current_page.lang_attributes(domain.page_langs.default, :title))
  50 + #end
39 subparts << content 51 subparts << content
40 when 'repeat' 52 when 'repeat'
41 #get template for normal state, active state and separator 53 #get template for normal state, active state and separator
@@ -273,7 +285,8 @@ module Kanjai @@ -273,7 +285,8 @@ module Kanjai
273 end 285 end
274 elsif item[:name] == 'p' 286 elsif item[:name] == 'p'
275 if item[:children].count > 0 287 if item[:children].count > 0
276 - subparts << "<p>#{self.replace_text_marker('p', item[:children][0][:source], hash_value).html_safe}</p>" 288 + #subparts << "<p>#{self.replace_text_marker('p', item[:children][0][:source], hash_value).html_safe}</p>"
  289 + subparts.p(attributes, self.replace_text_marker('p', item[:children][0][:source], hash_value).html_safe)
277 end 290 end
278 else 291 else
279 subparts.send(item[:name], attributes) do |next_subparts| 292 subparts.send(item[:name], attributes) do |next_subparts|
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.303" 2 + VERSION = "0.0.304"
3 end 3 end