module PageletRails::Concerns::ResponseWrapper extend ActiveSupport::Concern def process_action *args super.tap do if params[:target_container] && action_has_layout? && request.format.js? # wrap to js only if requested js response.content_type = 'text/javascript' html = self.response_body.reduce('') { |memo, body| memo << body memo } if html.match(/^\s*