fix submenu title

This commit is contained in:
JiangRu 2014-12-18 11:35:02 +08:00
parent d8eb35c355
commit 0f05fc2e99
1 changed files with 14 additions and 2 deletions

View File

@ -8,8 +8,10 @@ class SiteMenuWidgetsController < ApplicationController
else
pages = page.parent_page.sorted_published_child_pages
end
def create_json(pages)
items = []
widget_title = []
pages.each do |page|
item = {}
if page.child_page.size > 0
@ -41,10 +43,20 @@ class SiteMenuWidgetsController < ApplicationController
end
items
end
page_part_id = PagePart.where(:page_id => pages.first.parent_page_id).last.id
widgets = SubPart.where(:page_part_id => page_part_id).collect do |sp|
{
"widget_title" => sp.title
}
end
items = create_json(pages)
{
"pages" => items,
"extras" => {"widget_title" => "Sub Menu"}
"widget_title" => widgets
}
end