Skip to content

Add support for multiple locales. #64

@neskk

Description

@neskk

First of all, thank you for your awesome work ;)

I followed the guide on active admin wiki to add a language selection to the utility menu as in https://github.com/activeadmin/activeadmin/wiki/Switching-locale. The problem is that, using this theme it seems nested menus are broken.

initializers/active_admin.rb:

  config.namespace :admin do |admin|
    admin.build_menu :utility_navigation do |menu|
      menu.add label: "Languages" do |lang|
        lang.add label: "English", url: proc { url_for(locale: 'en') }, id: 'i18n-en', priority: 1
        lang.add label: "Português", url: proc { url_for(locale: 'pt') }, id: 'i18n-pt', priority: 2
      end

      admin.add_current_user_to_menu menu
      admin.add_logout_button_to_menu menu
    end
  end

resulting html:

          <li class="menu_item has_nested" id="languages">
            <a href="#">Languages</a>
            <ul class="menu">
              <li class="menu_item" id="i18n-en">
                <a href="/en/admin">English</a>
              </li>
              <li class="menu_item" id="i18n-pt">
                <a href="/pt/admin">Português</a>
              </li>
            </ul>
          </li>

Everything is "functional" but visually the menu isn't a drop-down:
image

When in view-ports with small resolution this also happens:
image

Would be great if you added some option to deal with this menus/submenus. E.g. include a helper that lets you choose the icon for the menu and fixes the markup to allow the drop-down menu to work.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions