From b564c71b3d56dc50eea5aa5f48003b8492efe7ae Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 3 Nov 2014 20:22:04 +0800 Subject: [PATCH] ajax load completed --- .../announcement_link_widgets_controller.rb | 14 ++++++++++++++ config/routes.rb | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/controllers/announcement_link_widgets_controller.rb b/app/controllers/announcement_link_widgets_controller.rb index 095b26d..8e9cb85 100644 --- a/app/controllers/announcement_link_widgets_controller.rb +++ b/app/controllers/announcement_link_widgets_controller.rb @@ -1,5 +1,12 @@ class AnnouncementLinkWidgetsController < ApplicationController + layout false def widget + { + "extras" => {} + } + end + + def render_content announcement_app = ModuleApp.find_by_key("announcement") link_app = ModuleApp.find_by_key("web_resource") OrbitHelper.override_widget_module_app("announcement") @@ -62,5 +69,12 @@ class AnnouncementLinkWidgetsController < ApplicationController "heading-links" => "Links" } } + + end + + def content + OrbitHelper.register_subpart(params["sub_part_id"]) + html = render_widget_for_frontend("announcement_link_widget","render_content","content") + render :html => html.html_safe end end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3b94a2c..ca0a965 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,2 +1,9 @@ -AnnouncementLinkWidget::Engine.routes.draw do +Rails.application.routes.draw do + + locales = Site.first.in_use_locales rescue I18n.available_locales + + # scope "(:locale)", locale: Regexp.new(locales.join("|")) do + get "/xhr/announcement_link_widget/content" => "announcement_link_widgets#content" + # end + end