Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix menu customizations in mobile #132

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading