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

Programmatic menus #1756

Merged
merged 5 commits into from
Mar 22, 2020
Merged

Programmatic menus #1756

merged 5 commits into from
Mar 22, 2020

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Mar 20, 2020

What is this pull request for?

This decouples partial generation and UI translations of menus from database contents. This is desirable so that
a) We keep with the general philosophy that users should not be able to do stuff in the admin that makes template changes necessary
b) We can use the same template for menus in multiple languages.

Notable changes (remove if none)

Root nodes now have a string like 'main_menu' as their name, and that is translated.

Screenshots

grafik

After changing the admin locale to German with no German translations:
grafik

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change (minimal tbh)

@mamhoff mamhoff force-pushed the programmatic-menus branch from 1d4f69b to bd573f4 Compare March 20, 2020 12:26
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Just two little nits

app/models/alchemy/node.rb Outdated Show resolved Hide resolved
@tvdeyen
Copy link
Member

tvdeyen commented Mar 20, 2020

@mamhoff there seems to be a feature spec failing that might be related?

@mamhoff mamhoff force-pushed the programmatic-menus branch from 33f3394 to 71d9229 Compare March 20, 2020 17:26
@mamhoff
Copy link
Contributor Author

mamhoff commented Mar 20, 2020

Yes, related - and fixed!

mamhoff added 2 commits March 21, 2020 10:46
We want to programmatically specify which menu names are allowed through
a YML file. This method makes the contents of this YML file available to
the app.
This adds a sample menus.yml to the install generator.
@mamhoff mamhoff force-pushed the programmatic-menus branch from 71d9229 to e615f40 Compare March 21, 2020 09:46
mamhoff added 3 commits March 21, 2020 19:48
This allows us to use the same partial for multi-language sites.
The name field on root nodes is not meant to be human-readable, but
rather translated.
@mamhoff mamhoff force-pushed the programmatic-menus branch from e615f40 to 3204ada Compare March 21, 2020 18:48
@tvdeyen
Copy link
Member

tvdeyen commented Mar 22, 2020

@mamhoff a rebase should fix the code coverage report issue

@tvdeyen tvdeyen merged commit 6ceafe7 into AlchemyCMS:master Mar 22, 2020
@tvdeyen tvdeyen mentioned this pull request Mar 22, 2020
3 tasks
tvdeyen added a commit that referenced this pull request Mar 30, 2020
tvdeyen added a commit that referenced this pull request Mar 30, 2020
- Sortable menus [#1758](#1758) ([mamhoff](https://github.com/mamhoff))
- Programmatic menus [#1756](#1756) ([mamhoff](https://github.com/mamhoff))
- Fix syntax in non-erb Menu templates [#1751]((#1751)) ([Alexander ADAM](https://github.com/alexanderadam))
- Fix `render_menu` for custom controllers [#1746]((#1746)) ([Alexander ADAM](https://github.com/alexanderadam))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants