views/mdc/components/actions/post.rb in voom-presenters-0.2.0 vs views/mdc/components/actions/post.rb in voom-presenters-2.0.0
- old
+ new
@@ -1,17 +1,14 @@
module WebClient
module Actions
class Post
+ include Voom::Presenters::WebClient::Helpers::ExpandHash
+
def call(action, parent_id, *)
# Type, URL, Options, Params (passed into javascript event/action classes)
[action.type, action.url,
- action.options.to_h.merge({__parent_id__: parent_id, input_tag: action.options[:input_tag]}),
- nils_to_empty_string(action.params.to_h)]
- end
-
- private
- def nils_to_empty_string(params)
- params.map {|k, v| [k, v.nil? ? '' : v]}.to_h
+ expand_hash(action.options).merge({__parent_id__: parent_id, input_tag: action.options[:input_tag]}),
+ expand_hash(action.dynamic_params)]
end
end
end
end