Skip to content

Commit

Permalink
Added feature toggle for widget partials rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
abujeda committed Dec 31, 2024
1 parent 431b787 commit 65138c6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/dashboard/config/configuration_singleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def boolean_configs
:upload_enabled => true,
:download_enabled => true,
:project_size_enabled => true,
:widget_partials_enabled => false,
}.freeze
end

Expand Down
7 changes: 6 additions & 1 deletion apps/dashboard/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
12 changes: 12 additions & 0 deletions apps/dashboard/test/integration/widgets_partial_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit 65138c6

Please sign in to comment.