From 9a959ea8ee4f253fef5e38d85840350b9161488c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Wed, 13 Dec 2023 13:09:02 +0100 Subject: [PATCH 1/6] Add Metadecidim menu in breadcrumb and footer --- config/initializers/metadecidim_menu.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/config/initializers/metadecidim_menu.rb b/config/initializers/metadecidim_menu.rb index b7085b4..40cd4a2 100644 --- a/config/initializers/metadecidim_menu.rb +++ b/config/initializers/metadecidim_menu.rb @@ -64,5 +64,28 @@ def home_content_block_menu label: t("layouts.decidim.header.main_menu") ) end + + def breadcrumb_root_menu + menu_name = current_organization.name == "Metadecidim" ? :metadecidim_menu : :menu + + @breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new( + menu_name, + self, + container_options: { class: "menu-bar__main-dropdown__menu" } + ) + end + + def footer_menu + menu_name = current_organization.name == "Metadecidim" ? :metadecidim_menu : :menu + + @footer_menu ||= ::Decidim::FooterMenuPresenter.new( + menu_name, + self, + element_class: "font-semibold underline", + active_class: "is-active", + container_options: { class: "space-y-4 break-inside-avoid" }, + label: t("layouts.decidim.footer.decidim_title") + ) + end end end From 9b223d29ae0499afe4d87116ebb2d211d2706d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Wed, 13 Dec 2023 13:09:33 +0100 Subject: [PATCH 2/6] Remove Home link in the home content block menu --- config/initializers/metadecidim_menu.rb | 46 ++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/config/initializers/metadecidim_menu.rb b/config/initializers/metadecidim_menu.rb index 40cd4a2..21bf97e 100644 --- a/config/initializers/metadecidim_menu.rb +++ b/config/initializers/metadecidim_menu.rb @@ -1,5 +1,49 @@ # frozen_string_literal: true +Decidim.menu :metadecidim_home_content_block_menu do |menu| + start_here_path = Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_path("Welcome") + menu.add_item :start_here, + I18n.t("menu.start_here", scope: "decidim"), + start_here_path, + position: 10, + active: :inclusive + + participate_path = Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_group_path(76) + menu.add_item :participate, + I18n.t("menu.participate", scope: "decidim"), + participate_path, + position: 20, + active: :inclusive + + meetings_path = Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path + menu.add_item :meetings, + I18n.t("menu.meetings", scope: "decidim"), + meetings_path, + position: 30, + active: :inclusive + + governance_path = Decidim::Assemblies::Engine.routes.url_helpers.assembly_path("our-governance") + menu.add_item :governance, + I18n.t("menu.governance", scope: "decidim"), + governance_path, + position: 40, + active: :inclusive + + news_path = Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.decidim_participatory_process_blogs_path("news", 1719) + menu.add_item :news, + I18n.t("menu.news", scope: "decidim"), + news_path, + position: 50, + active: :inclusive + + chat_url = "http://chat.decidim.org" + menu.add_item :chat, + I18n.t("menu.chat", scope: "decidim"), + chat_url, + position: 60, + active: :false +end + Decidim.menu :metadecidim_menu do |menu| menu.add_item :root, I18n.t("menu.home", scope: "decidim"), @@ -54,7 +98,7 @@ Rails.application.config.to_prepare do Decidim::MenuHelper.module_eval do def home_content_block_menu - menu_name = current_organization.name == "Metadecidim" ? :metadecidim_menu : :home_content_block_menu + menu_name = current_organization.name == "Metadecidim" ? :metadecidim_home_content_block_menu : :home_content_block_menu @home_content_block_menu ||= ::Decidim::MenuPresenter.new( menu_name, From f0d88b8e5c806b9609241c41dc67f9047914bec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Wed, 13 Dec 2023 13:11:05 +0100 Subject: [PATCH 3/6] Fix missing translations in the 'Start here' link --- config/locales/ca.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/ca.yml b/config/locales/ca.yml index a9811af..77e7db8 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -7,6 +7,6 @@ ca: meetings: Trobades news: Notícies participate: Participa - welcome: Benvinguda + start_here: Comença aquí sms: text: "El teu codi per verificar-te a Metadecidim és: %{code}" diff --git a/config/locales/es.yml b/config/locales/es.yml index 26a7fbf..4d85159 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -7,6 +7,6 @@ es: meetings: Encuentros news: Noticias participate: Participa - welcome: Bienvenida + start_here: Comienza aquí sms: text: "Tu código para verificarte en Metadecidim es: %{code}" From c3ba9e13b6b1bec0a05b15124319ed360bd0d375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Wed, 13 Dec 2023 13:36:41 +0100 Subject: [PATCH 4/6] Add specs --- spec/features/menu_spec.rb | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/spec/features/menu_spec.rb b/spec/features/menu_spec.rb index e226203..d5dd4c3 100644 --- a/spec/features/menu_spec.rb +++ b/spec/features/menu_spec.rb @@ -38,6 +38,19 @@ visit decidim.root_path within "#home__menu" do + expect(page).to have_content("Start here") + expect(page).to have_content("Participate") + expect(page).to have_content("Meetings") + expect(page).to have_content("Our governance") + expect(page).to have_content("News") + expect(page).to have_content("Chat") + end + end + + it "the footer menu has the Metadecidim elements" do + visit decidim.root_path + + within ".main-footer" do expect(page).to have_content("Home") expect(page).to have_content("Start here") expect(page).to have_content("Participate") @@ -47,5 +60,42 @@ expect(page).to have_content("Chat") end end + + it "the breadcrumb menu has the Metadecidim elements" do + visit decidim.pages_path + + find("a.menu-bar__breadcrumb-desktop__dropdown-trigger").sibling("button[data-component='dropdown']").hover + + within "#breadcrumb-main-dropdown-desktop" 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("Meetings") + expect(page).to have_content("Our governance") + expect(page).to have_content("News") + expect(page).to have_content("Chat") + end + end + + context "with another locale" do + before do + visit decidim.root_path + + within_language_menu do + click_link "Català" + end + end + + specify "the menu is translated" do + within "#home__menu" do + expect(page).to have_content("Comença aquí") + expect(page).to have_content("Participa") + expect(page).to have_content("Trobades") + expect(page).to have_content("Com ens organitzem") + expect(page).to have_content("Notícies") + expect(page).to have_content("Xat") + end + end + end end end From eab1ff50cbcc611ad8b7cb96f59c83d69131e316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Wed, 13 Dec 2023 13:46:27 +0100 Subject: [PATCH 5/6] Remove Meetings from the footer and the breadcrumb menu It's already there in the two cases --- config/initializers/metadecidim_menu.rb | 7 ------- spec/features/menu_spec.rb | 2 -- 2 files changed, 9 deletions(-) diff --git a/config/initializers/metadecidim_menu.rb b/config/initializers/metadecidim_menu.rb index 21bf97e..5b34186 100644 --- a/config/initializers/metadecidim_menu.rb +++ b/config/initializers/metadecidim_menu.rb @@ -65,13 +65,6 @@ position: 20, active: :inclusive - meetings_path = Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path - menu.add_item :meetings, - I18n.t("menu.meetings", scope: "decidim"), - meetings_path, - position: 30, - active: :inclusive - governance_path = Decidim::Assemblies::Engine.routes.url_helpers.assembly_path("our-governance") menu.add_item :governance, I18n.t("menu.governance", scope: "decidim"), diff --git a/spec/features/menu_spec.rb b/spec/features/menu_spec.rb index d5dd4c3..e9c7b89 100644 --- a/spec/features/menu_spec.rb +++ b/spec/features/menu_spec.rb @@ -54,7 +54,6 @@ expect(page).to have_content("Home") expect(page).to have_content("Start here") expect(page).to have_content("Participate") - expect(page).to have_content("Meetings") expect(page).to have_content("Our governance") expect(page).to have_content("News") expect(page).to have_content("Chat") @@ -70,7 +69,6 @@ expect(page).to have_content("Home") expect(page).to have_content("Start here") expect(page).to have_content("Participate") - expect(page).to have_content("Meetings") expect(page).to have_content("Our governance") expect(page).to have_content("News") expect(page).to have_content("Chat") From 2b2db9c5cf8340dd9e4826b3e19e8f116a4b875f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Pereira=20de=20Lucena?= Date: Wed, 13 Dec 2023 14:03:52 +0100 Subject: [PATCH 6/6] Lock ChromeDriver to 119.0.6045.105 --- .github/workflows/decidim_ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/decidim_ci.yml b/.github/workflows/decidim_ci.yml index 3575b9a..147455f 100644 --- a/.github/workflows/decidim_ci.yml +++ b/.github/workflows/decidim_ci.yml @@ -35,6 +35,9 @@ jobs: with: ruby-version: ${{ env.RUBY_VERSION }} bundler-cache: true + - uses: nanasess/setup-chromedriver@v2 + with: + chromedriver-version: 119.0.6045.105 - uses: actions/setup-node@v2 with: node-version: ${{ env.NODE_VERSION }}