-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[ADD] extensions: icon_role font awesome #8469
Conversation
d721fd2
to
325f172
Compare
Hello @odoo/doc-review and @odoo/design-doc-review 👋 I have an exciting PR that implements icons into documentation via a new custom role. I decided to make this custom role its own extension, rather than add it directly to the odoo_theme, however I added the icon sets the role uses to the odoo_theme. I tested icon RST formatting in all of the directives, and the :card: directive is the only one that the new :icon: role does not format in (title or body). I did not have any issues building with latex either, however, I did not try to use the :icon: role in the build. The need to implement icons into Odoo documentation stems from writing effectively for the end-user. By using the UI icons from Odoo in the documentation, we can directly reference the visual elements of the product when instructing the user. This has many benefits:
The US Content Marketing team has had to resort to using emojis and icon descriptors to instruct the user for UI elements. This has resulted in a cumbersome review process and multiple variations of emojis and descriptions used to depict an icon. Im looking forward to hearing your thoughts on this implementation of icons in documentation! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, good initiative! :)
Given that this role is specific to Odoo and its resources will live in the odoo_theme
directory, a separate extension is not needed.
Regarding the rendering of the role, I think we should limit it to just the <icon>
, instead of <icon> (<icon_class>)
. The reasons are that the writer might want to hide or rename the class, and I'm not convinced that the class would be translatable anyway.
325f172
to
de2dd98
Compare
Hi @AntoineVDV, thank you for your insightful review :) in de2dd98 I moved the role code to |
I'll give a few days to the design team to have a look before I make a final pass ;) |
Hello 👋 |
de2dd98
to
20b0760
Compare
Hi @Brieuc-brd, in 20b0760 I added a section in See the icon section here: https://runbot145.odoo.com/runbot/static/build/60967664-15-0/logs/build/html/contributing/documentation/rst_cheat_sheet.html#icons |
THIS IS SUPER EXCITING! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @samueljlieber 👋
Thanks for your work 👍
I've done some tests on runbot and I'm concerned about a few things:
- This PR targets documentation for Odoo 15, while
oi
icons were introduced in16.0
. This means that if the documentation uses these icons, users using Odoo before16.0
won't find them in the backend.
IMO,oi
should be added from16.0
.
Here's an example below :
In the Doc | In the backend |
---|---|
oi
icons have been created to fit the backend's font base, which is14px
. In the Documentation, the font base is16px
, which creates antialiasing when you renderoi
icons. I think a CSS adjustment would be necessary :)
Current | Expected |
---|---|
-
What about classes to handle sizes and fixed widths ? (
fa-lg
=>fa-5x
,oi-small
=>oi-larger
,fa-fw
&oi-fw
)
Is this something you don't need to add in the Documentation? -
Also, I don't see adaptations for RTL (https://github.com/odoo/odoo/blob/master/addons/web/static/lib/odoo_ui_icons/style.css#L63), is it something you don't need in the Documentation ?
-
Odoo UI icons is a library that will evolve in the future (icons may be added or updated in future versions). Do you have any plans to keep the library up to date for Documentation? :)
I think adding FontAwesome and UI icons in the Documentation is a good idea, but we need to be sure that everything is well defined to maintain consistency with the Backend :)
Courage 💪
cc. @stefanorigano
Thank you so much @Brieuc-brd for your thorough review and feedback on this PR- it is greatly appreciated 🙏 I want to share my thoughts on some of your points while I am working on implementing corrections for others.
Looking forward to continuing the discussion here, so the implementation of icons in docs is accurate and consistent with Odoo and set up to be scalable as we progress! Thanks again! |
20b0760
to
f1e54b6
Compare
Hi everyone, in f1e54b6 I did the following:
Please see the RST Cheatsheet Icons section for formatting examples. I am curious on your thoughts on including the color variations ( Thank you! |
Thanks for the initiative, @samueljlieber ! It should really help both documentation writers and Odoo users alike. |
@Brieuc-brd Did you want to make another pass? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey ! @samueljlieber 👋
Thanks for your work 👍
I've left a few comments below 😉
@samueljlieber |
@Brieuc-brd is using the There is an inline |
f1e54b6
to
590ddca
Compare
590ddca Implemented @Brieuc-brd 's suggestions, except for the I also implemented @jcs-odoo 's suggestion. |
Both 😅
I'm not an expert on the subject, perhaps @AntoineVDV would have an idea on how to proceed? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good job 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Brieuc-brd for the design review 👍
@samueljlieber Good work!
I pushed some changes in a fixup! commit to:
- use
register_canonical_role
which should be more appropriate; - remove the second call to
handle_error
because empty roles seems not to be interpreted; - merge
handle_error
intoicon_role
since it's small enough and called in only one place; - use the provided
text
variable rather than buildingfull_text
which, from what I can see, is essentiallytest
+ a space character at the end that is not interpreted when used in aclass
attribute; - insert back a
inliner.problematic
node into the rendered document.
If that's ok for you, let's merge 🚀
@robodoo delegate+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi everyone :)
Here are some cases (in 15.0) where a class could be useful to be defined, as the color of the icon indicates a status:
- activities (in Project, for example)
o_activity_color_planned
o_activity_color_planned
o_activity_color_overdue
- messages status in the chatter (if the mail bounces back for example)
- the components' availability in manufacturing orders
- No class on the FA icon, but the parent container has a green
btn-link
class text-danger
- No class on the FA icon, but the parent container has a green
- the favorite button, although it's not a class, but a different FA icon
- one is specific to Odoo
- the other is the FA icon but with a custom yellow color I think
However, the Odoo-related classes are not included here, and I wouldn't use the text-info
, text-success
, text-danger
, and text-warning
classes just to display a resembling color, since the only occurrence I could find was the use of text-danger
in Manufacturing.
Unless we add "Odoo classes" to this repo, and define clearly when to use them or not in the writing guidelines, I think it's best to avoid mentioning that we can add classes in the RST cheat sheet.
In any case, I think we'll have to add some instructions in the writing guidelines when we revisit them :)
What do you think?
Thank you @AntoineVDV for the fixup– I agree with your changes 👍
@jcs-odoo I agree with you that we should use the exact Odoo color classes and not substitute with the FA classes. I think you make some really good points. My main concern with using colored icons is standardizing how they are used– I worry that having Odoo color classes and FA color classes with FA icons (and eventually Odoo UI icons in 16.0+) is a lot of complexity to standardize in the doc guidelines, and may cause a lot of overhead for writers & reviewers. Im starting to think it may be best to just use black icons, and describe any color changes– also we still have the fill vs outline variations of icons. Ultimately, adding icons (with no color) is a huge step in precisely documenting the UI– is showing the color of the icon that necessary when we can just state it in the instruction?
As exciting as adding colors to icons is, I fear it adds more complexity than value. WDYT? If we agree to not use colors, I will remove the |
Indeed, let's not use color classes for now. |
bc812bf
to
3ebf78f
Compare
3ebf78f removed |
3ebf78f
to
9428a84
Compare
9428a84 Updated commit message: |
Merging and FWP up to master. I will be opening a new PR to introduce Odoo UI icons in 16.0+. |
closes #8469 Signed-off-by: Samuel Lieber (sali) <sali@odoo.com>
congrats ^^ |
Task: #3843168
This PR adds a custom extension for an
:icon:
role to allow the use of Font Awesome icons in documentation.With the new role, icons can be called by their classname.
If this PR is approved, it will likely need to be manually forward ported to each version.