diff --git a/app/views/admin/legislation/processes/index.html.erb b/app/views/admin/legislation/processes/index.html.erb index c32ce9d6d..42f1ca755 100644 --- a/app/views/admin/legislation/processes/index.html.erb +++ b/app/views/admin/legislation/processes/index.html.erb @@ -20,8 +20,10 @@ <%= t("admin.legislation.processes.process.start_date") %> <%= t("admin.legislation.processes.process.end_date") %> <%= t("admin.legislation.processes.process.comments") %> - <%= SDG::Goal.model_name.human(count: :other).upcase_first %> - <%= SDG::Target.model_name.human(count: :other).upcase_first %> + <% if feature?(:sdg) %> + <%= SDG::Goal.model_name.human(count: :other).upcase_first %> + <%= SDG::Target.model_name.human(count: :other).upcase_first %> + <% end %> <%= t("admin.actions.actions") %> @@ -34,8 +36,10 @@ <%= I18n.l process.start_date %> <%= I18n.l process.end_date %> <%= process.total_comments %> - <%= process.sdg_goal_list %> - <%= process.sdg_target_list %> + <% if feature?(:sdg) %> + <%= process.sdg_goal_list %> + <%= process.sdg_target_list %> + <% end %> <%= render Admin::TableActionsComponent.new(process) %> <% end %> diff --git a/app/views/admin/poll/polls/_poll.html.erb b/app/views/admin/poll/polls/_poll.html.erb index eb77fdd4f..364cc24db 100644 --- a/app/views/admin/poll/polls/_poll.html.erb +++ b/app/views/admin/poll/polls/_poll.html.erb @@ -2,8 +2,10 @@ <%= poll.name %> <%= l poll.starts_at.to_date %> <%= l poll.ends_at.to_date %> - <%= poll.sdg_goal_list %> - <%= poll.sdg_target_list %> + <% if feature?(:sdg) %> + <%= poll.sdg_goal_list %> + <%= poll.sdg_target_list %> + <% end %> <%= render Admin::TableActionsComponent.new(poll, destroy_confirmation: t("admin.polls.destroy.alert") diff --git a/app/views/admin/poll/polls/index.html.erb b/app/views/admin/poll/polls/index.html.erb index 2d55a37f9..7c060542a 100644 --- a/app/views/admin/poll/polls/index.html.erb +++ b/app/views/admin/poll/polls/index.html.erb @@ -14,8 +14,10 @@ <%= t("admin.polls.index.name") %> <%= t("admin.polls.index.start_date") %> <%= t("admin.polls.index.closing_date") %> - <%= SDG::Goal.model_name.human(count: :other).upcase_first %> - <%= SDG::Target.model_name.human(count: :other).upcase_first %> + <% if feature?(:sdg) %> + <%= SDG::Goal.model_name.human(count: :other).upcase_first %> + <%= SDG::Target.model_name.human(count: :other).upcase_first %> + <% end %> <%= t("admin.actions.actions") %> diff --git a/spec/system/admin/legislation/processes_spec.rb b/spec/system/admin/legislation/processes_spec.rb index 432a3baad..b16a7e5c5 100644 --- a/spec/system/admin/legislation/processes_spec.rb +++ b/spec/system/admin/legislation/processes_spec.rb @@ -371,6 +371,22 @@ describe "Admin collaborative legislation", :admin do Setting["sdg.process.legislation"] = true end + scenario "do not show SDG columns if disabled" do + process = create(:legislation_process, title: "Legislation process with SDG related content") + process.sdg_goals = [SDG::Goal[1], SDG::Goal[17]] + + Setting["feature.sdg"] = false + + visit admin_legislation_processes_path + + expect(page).not_to have_content "Goals" + expect(page).not_to have_content "Targets" + + within "tr", text: "Legislation process with SDG related content" do + expect(page).not_to have_content "1, 17" + end + end + scenario "create Collaborative Legislation with sdg related list" do visit new_admin_legislation_process_path fill_in "Process Title", with: "Legislation process with SDG related content" diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb index 15f0efc94..2e0ad9f77 100644 --- a/spec/system/admin/poll/polls_spec.rb +++ b/spec/system/admin/poll/polls_spec.rb @@ -526,6 +526,22 @@ describe "Admin polls", :admin do Setting["sdg.process.polls"] = true end + scenario "do not show SDG columns if disabled" do + poll = create(:poll, name: "Poll with SDG related content") + poll.sdg_goals = [SDG::Goal[1], SDG::Goal[17]] + + Setting["feature.sdg"] = false + + visit admin_polls_path + + expect(page).not_to have_content "Goals" + expect(page).not_to have_content "Targets" + + within "tr", text: "Poll with SDG related content" do + expect(page).not_to have_content "1, 17" + end + end + scenario "create poll with sdg related list" do visit new_admin_poll_path fill_in "Name", with: "Upcoming poll with SDG related content"