diff --git a/apps/dashboard/config/configuration_singleton.rb b/apps/dashboard/config/configuration_singleton.rb index 9db8aa902..b7dbc0c17 100644 --- a/apps/dashboard/config/configuration_singleton.rb +++ b/apps/dashboard/config/configuration_singleton.rb @@ -55,6 +55,7 @@ def boolean_configs :upload_enabled => true, :download_enabled => true, :project_size_enabled => true, + :widget_partials_enabled => false, }.freeze end diff --git a/apps/dashboard/config/routes.rb b/apps/dashboard/config/routes.rb index bf13ea007..2c2eefc6f 100644 --- a/apps/dashboard/config/routes.rb +++ b/apps/dashboard/config/routes.rb @@ -106,7 +106,12 @@ post 'settings', :to => 'settings#update' - match '/widgets/*widget_path', to: 'widgets#show', via: [:get, :post], as: 'widgets' + # Experimental Feature + # Allows widget partials to be rendered without any page furniture. + # It can be use to extend OOD functionality. + if Configuration.widget_partials_enabled? + match '/widgets/*widget_path', to: 'widgets#show', via: [:get, :post], as: 'widgets' + end # Support ticket routes if Configuration.support_ticket_enabled? diff --git a/apps/dashboard/test/integration/widgets_partial_test.rb b/apps/dashboard/test/integration/widgets_partial_test.rb index 9349dba28..9e640e2b0 100644 --- a/apps/dashboard/test/integration/widgets_partial_test.rb +++ b/apps/dashboard/test/integration/widgets_partial_test.rb @@ -3,6 +3,18 @@ class WidgetsPartialTest < ActionDispatch::IntegrationTest + def setup + Configuration.stubs(:widget_partials_enabled?).returns(true) + Rails.application.reload_routes! + end + + test 'should not load widgets partial route when widget_partials_enabled? is false' do + Configuration.stubs(:widget_partials_enabled?).returns(false) + Rails.application.reload_routes! + + refute respond_to?(:widgets_url) + end + test 'should render widget partial without any layout furniture' do get widgets_url('widgets_partial_test')