зеркало из https://github.com/mozilla/bedrock.git
42ea7e3a76
* Refactor the logic for enumerating available locales for a CMS page ...so that we can use it independently of AbstractBedrockCMSPage._patch_request_for_bedrock() in the enhancement to follow * Ensure get_locales_for_cms_page ignores draft pages * Set correct lang-picker options when different locales for a given path may be served by the CMS or the Django fallback view * Expand prefer_cms to take args that tell us what locales are available in the Django fallback version of the page * In prefer_cms annotate the request with lists of locales available in a CMS-backed version of the page and a Django-backed version * Add a new jinja helper to select the most appropriate list of locales to pass to the lang picker UI element * Add tests; drop support for using prefer_cms with the page() decorator Making it support a list of automatically-detected Fluent files would make the page() helper even busier, with little value: if we need to decorate a page() view with prefer_cms, we can refactor it to be a regular Django view and then decorate in the URLConf or on the view itself (Had to commit all in one go, alas, due to pre-commit constraints) * Add support for a dynamic callable of locales for a page This is to satisfy situations like the current VPN RC where overall it's available in 10 locales, but it's not consistently translated into all 10, so we can't claim that all pages are available in all of those locales in the picker. This approach makes the locale derivation pluggable * Use the new dynamic/callable approach to get locales with the _old_ VPN RC article page (The version with data exported from Contentful, ahead of us moving it all to Wagtail) * Update other parts of the codebase that may need to use the new lang-switcher code to cope with alt/fallback sources of locale info * Rename helper func for getting locales to be more generic * Update documentation for prefer_cms * Fix regression due to a bad rebase * Remove deprecated approach to passing in locale info * Expand test coverage, fix comments/feedback * Update import to be absolute not relative * Change DB-hitting list comprehension to be a subquery, for better performance |
||
---|---|---|
.. | ||
_static | ||
_templates | ||
architecture/decisions | ||
attribution | ||
images | ||
Makefile | ||
abtest.rst | ||
architectural-decisions.rst | ||
attribution.rst | ||
banners.rst | ||
browser-support.rst | ||
build-github.zsh | ||
cms.rst | ||
coding.rst | ||
conf.py | ||
content-cards.rst | ||
contentful.rst | ||
contribute.rst | ||
download-buttons.rst | ||
index.rst | ||
install.rst | ||
l10n.rst | ||
legal-docs.rst | ||
mozilla-accounts.rst | ||
newsletters.rst | ||
pipeline.rst | ||
redirects.rst | ||
send-to-device.rst | ||
sitemap.rst | ||
task-queue.rst | ||
testing.rst | ||
uitour.rst | ||
vpn-subscriptions.rst |