From a95dd259022c2d1fe3367b7e6a0d26be4af20d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Fri, 26 Jul 2024 10:54:23 +0200 Subject: [PATCH 1/3] Fix menu customizations in mobile --- config/initializers/metadecidim_menu.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/initializers/metadecidim_menu.rb b/config/initializers/metadecidim_menu.rb index 1a5543e..d1932ad 100644 --- a/config/initializers/metadecidim_menu.rb +++ b/config/initializers/metadecidim_menu.rb @@ -131,5 +131,15 @@ def footer_menu label: t("layouts.decidim.footer.decidim_title") ) end + + def mobile_breadcrumb_root_menu + menu_name = current_organization.name["en"] == "Metadecidim" ? :metadecidim_menu : :mobile_menu + + @mobile_breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new( + menu_name, + self, + container_options: { class: "menu-bar__main-dropdown__menu" } + ) + end end end From fb8011a9c24cf0b36dd84c8e4fa839a8ab270054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Fri, 26 Jul 2024 10:54:41 +0200 Subject: [PATCH 2/3] Fix seed with multilanguage organizations --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index d98ddd9..151f444 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -17,7 +17,7 @@ puts "-- Changing the organization's name to Metadecidim" organization = Decidim::Organization.first -organization.update!(name: 'Metadecidim') +organization.update!(name: { en: "Metadecidim" }) puts "-- Applying corporative colors" organization.update!(colors: { alert: "#e7131a", primary: "#c8102e", success: "#28a745", warning: "#ffb703", tertiary: "#ebc34b", secondary: "#1a5fb4"}) From d8ef3ae99f40736e81119feabffebc7fc512309c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Fri, 26 Jul 2024 11:02:17 +0200 Subject: [PATCH 3/3] Add spec --- spec/features/menu_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/features/menu_spec.rb b/spec/features/menu_spec.rb index 00d35ed..7bf409b 100644 --- a/spec/features/menu_spec.rb +++ b/spec/features/menu_spec.rb @@ -97,5 +97,26 @@ end end end + context "when the device is mobile" do + before do + driven_by(:iphone) + switch_to_host(organization.host) + visit decidim.root_path + end + + specify "the menu is customized" do + click_on "Main menu" + + within "#breadcrumb-main-dropdown-mobile" do + expect(page).to have_content("Home") + expect(page).to have_content("Start here") + expect(page).to have_content("Participate") + expect(page).to have_content("The Association") + expect(page).to have_content("News") + expect(page).to have_content("Decidim Fest") + expect(page).to have_content("Chat") + end + end + end end end