wagtail / wagtail

A Django content management system focused on flexibility and user experience

Home Page:https://wagtail.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ability for Settings (contrib) icons to be reflected on the Setting edit views

lb- opened this issue · comments

Is your proposal related to a problem?

When registering a setting (either site specific or generic), there is the option to register it with an icon like follows:

@register_setting(icon="site")
class SiteSettings(BaseSiteSetting):
    # ...

See https://docs.wagtail.org/en/stable/reference/contrib/settings.html#appearance

However, this icon is only used in the menu and not the actual edit view of the same setting.

Screenshot 2024-03-24 at 4 49 30 pm

Screenshot 2024-03-24 at 4 49 34 pm

Describe the solution you'd like

It would be great to ensure that the settings' edit view header had access to this same registered icon and then show it when editing the setting.

This would help editors have a visual confirmation that they have clicked the right thing, especially when there are multiple settings available.

A simple way to do this would be to add an icon property to the Model when register_setting is used, however this risks breaking any field also named icon. Maybe we need a registry of settings models & icons somehow added to wagtail/contrib/settings/registry.py and then used in wagtail/contrib/settings/views.py when setting up the views.

Describe alternatives you've considered

Leave as is, this is not a critical item, just a nice UX improvement.

Additional context

  • There is a similar request to have the ability to set the icon on a Page model here #9652
  • Snippets already have support for icons to be used across the menu and whenever being edited/viewed or chosen/managed.
  • An older PR was prepared for this #8650 - but since it was created it got a bit behind main (without a review) and now is out of sync with a lot of recent improvements and simplifications of how header icons work.

Working on this

Anyone can contribute to this, it would be recommended to suggest an approach on the issue before digging too deep.

Dig into how Snippets set their icons and also the proposed Page approaches here #9652 (comment) for inspiration.

View our contributing guidelines, add a comment to the issue once you’re ready to start.

Hello @lb- I've created a draft PR (#11818) and would appreciate our thoughts on it.