[IMP] base_fontawesome: add fontawesome_picker field widget#3663
Open
MarianoMartinezGC wants to merge 2 commits into
Open
[IMP] base_fontawesome: add fontawesome_picker field widget#3663MarianoMartinezGC wants to merge 2 commits into
MarianoMartinezGC wants to merge 2 commits into
Conversation
Add a reusable OWL field widget that turns any Char storing a FontAwesome class into a searchable icon grid with live preview and a clear button, instead of typing the CSS class by hand. The catalog is read at runtime from the loaded stylesheets (the same approach as web_editor's icon selector, replicated here to depend on web only), so it always reflects the FontAwesome version shipped by this module. Registered on form views only. Covered by a QUnit suite.
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.
What
Add a reusable OWL field widget,
fontawesome_picker, that can be applied toany
Charfield storing a FontAwesome CSS class.<field name="icon" widget="fontawesome_picker"/>Instead of typing the class by hand, the user gets a searchable grid of icons
with a live preview and a clear button. Selecting an icon writes its full class
(e.g. fa fa-shopping-cart) into the field.
Why
Fields that store a FontAwesome class are currently filled by typing the class
name from memory. This is error-prone (a typo renders nothing) and slow, since
it forces the user to look the icon up outside Odoo. There is no free OCA widget
for this today.
How
technique as web_editor's icon selector), so it always reflects the
FontAwesome version shipped by this module — no hard-coded list to maintain.
The selector-scan is replicated locally so the module keeps depending on web
only (avoiding web_editor and its globally-cached computeFonts).
input inside the dropdown does not interfere wit
single scroll); the rendered grid is capped, with a hint to refine the search.
readonly rendering, capped grid, empty-catalog fallback).
How to test
On a runboat build (database with all modules),
widget="fontawesome_picker" to any Char field of
via Studio or a quick view override). Open the form: the field shows a button
with the current icon; clicking it opens a searchable grid; picking an icon
writes its class and previews it; the clear button empties the value.
FL-556-9206