WIP: Allow Thumbnail Choice Blocks To Use All Icons In A Directory#1240
Draft
dchukhin wants to merge 134 commits into
Draft
WIP: Allow Thumbnail Choice Blocks To Use All Icons In A Directory#1240dchukhin wants to merge 134 commits into
dchukhin wants to merge 134 commits into
Conversation
…ocale when the requested locale page is not found
Note: this logic shouldn't be needed, since all of the locales should be present in the database, but in case one of the locale records is removed from the database, but the locale is still referenced in the code (for example, in the settings), this logic will handle it.
CANONICAL_LANG matches LANG, unless a page is served for a fallback locale. In this case, the template can determine which context variable (LANG or CANONICAL_LANG) to use in each relevant place.
when a user requests a page and is given content for a fallback locale, the page links in the content should match the requested URL's locale.
…ent from alias locale URL when alias locale has no content
… alias Locale does not exist in the database
…when alias Locale does not exist in the database
this fixes an error where translating a page into the new Locales was causing a server error, because wagtail-localize was not able to correctly find the root page in the new Locale.
do not show hreflang alternates for alias locales that don't have their own content
…' into icon-directory-for-thumbnails
…he changes on this branch
maribedran
approved these changes
Apr 29, 2026
…ringfield into icon-directory-for-thumbnails
…' into icon-directory-for-thumbnails
…' into icon-directory-for-thumbnails
Base automatically changed from
WT-961-programmatically-make-cms-compare-and-more-pages
to
main
May 13, 2026 21:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-line summary
This pull request updates our
IconChoiceBlockto use all icons in a directory.Significant changes and points to review
More specifically, the changes are:
wagtail_thumbnail_choice_blocksupport pointing aThumbnailChoiceBlockat a directory, and Wagtail users being able to choose any of the icons from that directory.IconListItemBlocknow uses aThumbnailChoiceBlock, setting thethumbnail_directorytoimg/firefox/flare/2026/icons, which makes all icons in that directory (and all of its subdirectories) choices for the blockspringfield/cms/management/commands/generate_flare_icon_css.pymanagement command allows creating a file of CSS rules, setting the--icon-srcfor each of the files in the directory (and all of its subdirectories). I ran this command for the files inmedia/img/firefox/flare/2026/icons/desktop-16, and added CSS rules for them tomedia/css/cms/flare26-icon.css.springfield/cms/icon_utils.pyfile. For example,icon_value_fn()takes a relative path to a file, and returns an icon name (given "desktop-16/arrows-and-chevrons/forward-16", it returns "forward"). This function is used by theThumbnailChoiceBlockto determine which value to save in the database when a user chooses an icon. Since a number of icon paths would result in identical values ("mobile-24/arrows-chevrons/forward-24.svg" would also want to be "forward"), any value collisions are handled explicitly in theicon_value_fn.TODO:
Issue / Bugzilla link
Testing
wagtail_thumbnail_choice_blockchanges:pip uninstall wagtail-thumbnail-choice-blockandpip install wagtail-thumbnail-choice-block@git+https://github.com/lincolnloop/wagtail-thumbnail-choice-block.git@mainiconset, and make sure that it is still set and shows up as expected in article cards list blocks