Created
July 1, 2009 22:51
-
-
Save terrbear/139130 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =================================================================== | |
| --- lib/widgets/external_widgets.rb (revision 13560) | |
| +++ lib/widgets/external_widgets.rb (working copy) | |
| @@ -50,7 +50,8 @@ | |
| (defined?(@@opts) && @@opts) || {} | |
| end | |
| def self.set(opts={}) | |
| @@opts = opts.clone | |
| end | |
| end | |
| @@ -73,14 +74,14 @@ | |
| myopts.merge!(gadgets_hash(opts)) | |
| logd { "gadget opts = #{myopts.inspect}" } | |
| - ProfileInformationOptions.set(myopts) | |
| + ProfileInformationOptions.set(myopts) && myopts | |
| end | |
| private | |
| def gadgets_hash(opts) | |
| { | |
| :id => opts[:widget].id, | |
| - :url => opts[:widget].interpolated_body(current_user) | |
| + :url => opts[:widget].interpolated_body(current_user, :include_dynamic_opts => false) | |
| } | |
| end | |
| Index: app/models/widget.rb | |
| =================================================================== | |
| --- app/models/widget.rb (revision 13560) | |
| +++ app/models/widget.rb (working copy) | |
| @@ -100,7 +100,8 @@ | |
| attrs | |
| end | |
| - def interpolated_body(user) | |
| + def interpolated_body(user, args = {}) | |
| + args.reverse_merge!({:include_dynamic_opts => true}) | |
| return body if self.type != 'iframe_portlet' || prefs.blank? | |
| #some opts need to be either (a) always passed around to iframe_portlets (esp. our gadgets), or (b) generated dynamically | |
| interpolation_hash = { :auth_session_index => Thread.current[:auth_token], | |
| @@ -110,7 +111,7 @@ | |
| query_opts = [] | |
| #match up pref values to corresponding params | |
| prefs.each do |key, val| | |
| - if key == :_dynamic_opts_call | |
| + if key == :_dynamic_opts_call && args[:include_dynamic_opts] | |
| # Here "val" must be an absolute path to a module which has a "dynamic_opts" method which takes a widget and returns a hash | |
| query_opts << val.constantize.send(:dynamic_opts, self).map { |k, v| "#{k}=#{v}" }.join('&') | |
| elsif val.is_a?(Symbol) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment