-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[ADD] UI: odoo spreadsheets svg icons #13386
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
Conversation
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.
2 little details and we should be good to go 😎
extensions/odoo_theme/__init__.py
Outdated
@@ -125,7 +126,12 @@ def icon_role(name, rawtext, text, lineno, inliner, options=None, content=None): | |||
icon_html = f'<i class="oi {text}"></i>' | |||
elif text.startswith('fa-'): | |||
icon_html = f'<i class="fa {text}"></i>' | |||
elif text.startswith('os-'): | |||
icon_html = ( | |||
f'<svg class="os-icon" aria-hidden="true" role="img">' |
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.
f'<svg class="os-icon" aria-hidden="true" role="img">' | |
'<svg class="os-icon" aria-hidden="true" role="img">' |
extensions/odoo_theme/__init__.py
Outdated
elif text.startswith('os-'): | ||
icon_html = ( | ||
f'<svg class="os-icon" aria-hidden="true" role="img">' | ||
f' <use href="#{text[3:]}" />' |
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.
A little comment about why text[3:]
and not just text
will be nice.
5447d56
to
a682396
Compare
Hi @rugo-odoo! Thank you for your review 😄 I implemented your helpful suggestions and opened this PR up from draft. I figured I could manually backport to 18.0 once merged, WDYT? :) |
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.
I figured I could manually backport to 18.0 once merged, WDYT? :)
You should rather re-target this PR and let the automatic forward-port handle master after.
|
||
Follow the icon with its name as a :ref:`contributing/rst/guilabel` in brackets as a descriptor. | ||
|
||
.. spoiler:: View supported Odoo Spreadsheets icons |
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.
Shouldn't this be hosted at the same place as Odoo UI icons?
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.
I suppose it can be, I wasn't sure of the best place to list the Odoo Spreadsheet (os-*
) icons, since they are not part of the Odoo UI (oi-*
) font-family.
Adding them to the developer/reference/user_interface/icons
page in the same format would be a convenient and logical place. I'll add a header for Odoo Spreadsheet icons :)
extensions/odoo_theme/layout.html
Outdated
@@ -113,6 +113,7 @@ | |||
{%- else %} | |||
<article id="o_content" class="doc-body"> | |||
<div role="main"> {# Beacon used by the Sphinx search to know where to look for a string #} | |||
{% include "static/img/odoo-spreadsheets-icons.svg" %} |
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.
Why here in particular? Shouldn't this go in another, assets-dedicated block?
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.
I included the svg sprite file here because I wanted it to be contained within main document body, however, looking at it again there is a better spot– as well the opportunity to create an "assets.html" layout_template to include this and future assets as well :)
a682396
to
9f9eea4
Compare
Thank you @AntoineVDV for your helpful comments! Changes in 9f9eea4:
Ready for another look, thanks all! :) |
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.
@robodoo delegate+
@robodoo r+ |
Task: #4792034
This PR proposes introducing the o-spreadsheet icons into the Odoo documentation.
How this works
The Spreadsheet library in Odoo contains two QWeb template files for SVG icons:
These were used to generate an SVG sprite file (
extensions/odoo_theme/static/img/odoo-spreadsheet-icons.svg
), which can then be utilized by the SVG<use>
element to call nodes by ID in the sprite.This SVG sprite file is then included in the main page layout (
extensions/odoo_theme/layout.html
)The RST
:icon:
role was updated to accomodate anos-*
icon specifier.The SVG sprite file can be generated automatically via a simple script outlined in this gist:
https://gist.github.com/samueljlieber/5ae7648a5ca08e0bfc8455861825e2ff
Why?
Example
With this implementation, o-spreadsheet icons can be used like so: