Skip to content

Commit

Permalink
Fix menu customizations in mobile (#132)
Browse files Browse the repository at this point in the history
* Fix menu customizations in mobile

* Fix seed with multilanguage organizations

* Add spec
  • Loading branch information
andreslucena authored Jul 30, 2024
1 parent 74da377 commit 4e45449
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions config/initializers/metadecidim_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
21 changes: 21 additions & 0 deletions spec/features/menu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4e45449

Please sign in to comment.