lib/glimmer/dsl/opal/custom_widget_expression.rb in glimmer-dsl-opal-0.28.3 vs lib/glimmer/dsl/opal/custom_widget_expression.rb in glimmer-dsl-opal-0.29.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2020-2021 Andy Maleh
+# Copyright (c) 2020-2022 Andy Maleh
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
@@ -50,11 +50,11 @@
end
custom_widget_class = UI::CustomWidget.for(keyword)
# TODO clean code by extracting methods into CustomShell
if !Glimmer::UI::CustomShell.requested? && custom_widget_class&.ancestors&.to_a.include?(Glimmer::UI::CustomShell)
if Glimmer::SWT::DisplayProxy.instance.shells.empty? || Glimmer::SWT::DisplayProxy.open_custom_shells_in_current_window?
- custom_widget_class.new(parent, *args, {}, &block)
+ custom_widget_class.new(parent, args, {}, &block)
else
options = args.last.is_a?(Hash) ? args.pop : {}
options = options.merge('swt_style' => args.join(',')) unless args.join(',').empty?
params = {
'custom_shell' => keyword
@@ -73,10 +73,10 @@
CustomWidgetExpression.new.interpret(nil, custom_shell_keyword, *[parameters])
`history.pushState(#{parameters.reject {|k,v| k == 'custom_shell_handled'}}, document.title, #{"?#{Glimmer::UI::CustomShell.encoded_request_parameter_string.sub('&custom_shell_handled=true', '')}"})`
# just a placeholder that has an open method # TODO return an actual CustomShell in the future that does the work happening above in the #open method
Glimmer::SWT::MakeShiftShellProxy.new
else
- custom_widget_class&.new(parent, *args, {}, &block)
+ custom_widget_class&.new(parent, args, {}, &block)
end
end
end
# TODO delete if no longer needed