diff --git a/app/helpers/admin/enterprises_helper.rb b/app/helpers/admin/enterprises_helper.rb index 7201d9f87f..8393c9d779 100644 --- a/app/helpers/admin/enterprises_helper.rb +++ b/app/helpers/admin/enterprises_helper.rb @@ -50,6 +50,7 @@ module Admin { name: 'shop_preferences', icon_class: "icon-shopping-cart", show: is_shop }, { name: 'users', icon_class: "icon-user", show: true }, { name: 'white_label', icon_class: "icon-leaf", show: true }, + { name: 'connected_apps', icon_class: "icon-puzzle-piece", show: feature?(:connected_apps) }, ] end end diff --git a/app/views/admin/enterprises/form/_connected_apps.html.haml b/app/views/admin/enterprises/form/_connected_apps.html.haml new file mode 100644 index 0000000000..15b48822d8 --- /dev/null +++ b/app/views/admin/enterprises/form/_connected_apps.html.haml @@ -0,0 +1 @@ +in progress diff --git a/config/locales/en.yml b/config/locales/en.yml index 9926da47b1..845cf4b1e3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1279,6 +1279,8 @@ en: create_custom_tab: "Create custom tab in shopfront" custom_tab_title: "Title for custom tab" custom_tab_content: "Content for custom tab" + connected_apps: + legend: "Connected apps" actions: edit_profile: Settings properties: Properties @@ -1532,6 +1534,7 @@ en: users: "Users" vouchers: Vouchers white_label: "White Label" + connected_apps: "Connected apps" enterprise_group: primary_details: "Primary Details" users: "Users" diff --git a/lib/open_food_network/feature_toggle.rb b/lib/open_food_network/feature_toggle.rb index f1a075ef8f..feb89bb597 100644 --- a/lib/open_food_network/feature_toggle.rb +++ b/lib/open_food_network/feature_toggle.rb @@ -47,6 +47,10 @@ module OpenFoodNetwork "invoices" => <<~DESC, Preserve the state of generated invoices and enable multiple invoice numbers instead of only one live-updating invoice. DESC + "connected_apps" => <<~DESC, + Enterprise data can be shared with another app. + The first example is the Australian Discover Regenerative Portal. + DESC }.freeze # Features you would like to be enabled to start with. diff --git a/spec/system/admin/enterprises/connected_apps_spec.rb b/spec/system/admin/enterprises/connected_apps_spec.rb new file mode 100644 index 0000000000..7a10d5af8b --- /dev/null +++ b/spec/system/admin/enterprises/connected_apps_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require "system_helper" + +describe "Connected Apps", feature: :connected_apps do + let(:enterprise) { create(:enterprise) } + + before do + login_as enterprise.owner + end + + it "is not visible by default" do + # Assuming that this feature will be the default one day, I'm treating this + # as special case and disable the feature. I don't want to wrap all other + # test cases in a context block for the feature toggle which will need + # removing one day. + Flipper.disable(:connected_apps) + visit edit_admin_enterprise_path(enterprise) + expect(page).to_not have_content "CONNECTED APPS" + end + + it "is visible" do + visit edit_admin_enterprise_path(enterprise) + expect(page).to have_content "CONNECTED APPS" + + scroll_to :bottom + click_link "Connected apps" + expect(page).to have_content "in progress" + end +end