From 1a1b79cc15720a410160d0008e0bbd31607ee60a Mon Sep 17 00:00:00 2001 From: JiangRu Date: Wed, 24 Dec 2014 09:22:21 +0800 Subject: [PATCH] fix widget title --- app/controllers/site_menu_widgets_controller.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/site_menu_widgets_controller.rb b/app/controllers/site_menu_widgets_controller.rb index a1aeb0a..6fcbe7d 100644 --- a/app/controllers/site_menu_widgets_controller.rb +++ b/app/controllers/site_menu_widgets_controller.rb @@ -8,6 +8,13 @@ class SiteMenuWidgetsController < ApplicationController else pages = page.parent_page.sorted_published_child_pages end + + page.page_parts.collect do |pp| + pp.sub_parts.collect do |sp| + @title = sp.title if sp.module == "site_menu_widget" + end + end + def create_json(pages) items = [] pages.each do |page| @@ -41,10 +48,12 @@ class SiteMenuWidgetsController < ApplicationController end items end + + items = create_json(pages) { "pages" => items, - "extras" => {"widget_title" => "Sub Menu"} + "extras" => {"widget_title" => @title} } end