lib/pagelet_rails/concerns/controller.rb in pagelet_rails-0.1.7 vs lib/pagelet_rails/concerns/controller.rb in pagelet_rails-0.1.8
- old
+ new
@@ -6,11 +6,14 @@
include PageletRails::Concerns::ResponseWrapper
include PageletRails::Concerns::Routes
include PageletRails::Concerns::Options
include PageletRails::Concerns::Cache
include PageletRails::Concerns::Placeholder
+ include PageletRails::Concerns::Tags
+ include PageletsHelper
+
prepend_before_action :merge_original_pagelet_options
prepend_before_action :append_pagelet_view_paths
append_view_path 'app/pagelets/'
append_view_path 'test/dummy/app/pagelets/' if Rails.env.test?
@@ -50,15 +53,16 @@
def merge_original_pagelet_options
if params[:original_pagelet_options]
opts = PageletRails::Encryptor.decode(params[:original_pagelet_options])
pagelet_options(opts)
+ pagelet_options(original_options: opts)
end
end
- def pagelet_encoded_original_options
- encode_data = pagelet_options.original_options.to_h.except('remote')
+ def pagelet_encoded_original_options new_opts = {}
+ encode_data = pagelet_options.original_options.to_h.except('remote').merge(new_opts)
PageletRails::Encryptor.encode(encode_data)
end
def pagelet_render_remotely?
case pagelet_options.remote
@@ -77,6 +81,12 @@
end
render_remotely
end
+ def redirect_to *args
+ options = args.extract_options!
+ new_params = options.merge(original_pagelet_options: pagelet_encoded_original_options)
+
+ render plain: pagelet(url_for(*args, new_params))
+ end
end