lib/erp_app/widgets/base.rb in erp_app-4.0.0 vs lib/erp_app/widgets/base.rb in erp_app-4.2.0
- old
+ new
@@ -21,11 +21,12 @@
IGNORED_PARAMS = %w{action controller uuid widget_name widget_action dynamic_form_id dynamic_form_model_id
model_name use_dynamic_form authenticity_token is_html_form commit utf8}
delegate :redirect_to, :config, :params, :session, :request, :logger, :logged_in?, :current_user, :login,
- :flash, :update_div_id, :update_html, :current_theme_paths, :request, :to => :proxy_controller
+ :flash, :update_div_id, :update_html, :current_theme_paths, :request, :cookies,
+ :protect_against_forgery?, :form_authenticity_token, :to => :proxy_controller
attr_reader :state_name
attr_accessor :proxy_controller, :name, :div_id,:html, :view, :uuid, :widget_params
cattr_accessor :view_resolver_cache
@@ -98,11 +99,12 @@
else
opts = {:view => update_opts[:view]}
process_opts_for(opts, view)
js = render_to_string(opts).html_safe
end
- return {:json => {:htmlId => update_opts[:id], :html => js}}
+ extra_params = update_opts[:extraParams] || {}
+ return {:json => {:htmlId => update_opts[:id], :html => js, :success => true, :extraParams => extra_params}}
elsif (opts.keys & [:text, :inline, :file]).blank?
process_opts_for(opts, view)
return render_to_string(opts).html_safe # ActionView::Template::Text doesn't do that for us.
else
return opts
@@ -114,11 +116,11 @@
end
def merge_params
stored_widget_params = session[:widgets][self.uuid]
unless stored_widget_params.nil?
- self.params.merge!(stored_widget_params)
+ self.params.merge! stored_widget_params.merge self.params
end
end
def store_widget_params
session[:widgets] = {} if session[:widgets].nil?
@@ -177,6 +179,6 @@
end
end
end#Base
end#Widgets
-end#ErpApp
\ No newline at end of file
+end#ErpApp