From 8afa6434befa2683cc123395c6a23347a7431683 Mon Sep 17 00:00:00 2001 From: Elvia Benedith <116598037+ElviaBth@users.noreply.github.com> Date: Thu, 16 May 2024 16:57:00 +0200 Subject: [PATCH] Remove sidebar when conference has no components (#12849) * add conditional render for layouts * pass rubocop * adjust column size * add title to conference spec check * remove title from spec * refactor adding a variable --- .../conferences/conferences/show.html.erb | 3 ++- .../spec/system/conferences_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/decidim-conferences/app/views/decidim/conferences/conferences/show.html.erb b/decidim-conferences/app/views/decidim/conferences/conferences/show.html.erb index b84671c8a8e33..2c2a63e0337f2 100644 --- a/decidim-conferences/app/views/decidim/conferences/conferences/show.html.erb +++ b/decidim-conferences/app/views/decidim/conferences/conferences/show.html.erb @@ -37,7 +37,8 @@ edit_link( <%= render partial: "conference_hero" %> - <%= render layout: "layouts/decidim/shared/layout_two_col", locals: { reverse: true, main_enabled: false } do %> + <% layout_style = conference_nav_items(current_participatory_space).any? ? "layout_two_col" : "layout_center" %> + <%= render layout: "layouts/decidim/shared/#{layout_style}", locals: { reverse: true, main_enabled: false, columns: 10 } do %> <%= participatory_space_floating_help %> diff --git a/decidim-conferences/spec/system/conferences_spec.rb b/decidim-conferences/spec/system/conferences_spec.rb index 5706492cbf7f0..42d08394e1661 100644 --- a/decidim-conferences/spec/system/conferences_spec.rb +++ b/decidim-conferences/spec/system/conferences_spec.rb @@ -141,6 +141,10 @@ visit decidim_conferences.conference_path(conference) end + it "has a sidebar" do + expect(page).to have_css(".conference__nav-container") + end + describe "follow button" do let!(:user) { create(:user, :confirmed, organization:) } let(:followable) { conference } @@ -267,4 +271,16 @@ end end end + + describe "when the conference has no components" do + let!(:conference) { base_conference } + + before do + visit decidim_conferences.conference_path(conference) + end + + it "has no sidebar" do + expect(page).to have_no_css(".conference__nav-container") + end + end end