8000 [IMP] extensions: icon_role odoo ui · odoo/documentation@80122d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 80122d9

Browse files
committed
[IMP] extensions: icon_role odoo ui
closes #9244 X-original-commit: a39903c Signed-off-by: Samuel Lieber (sali) <sali@odoo.com>
1 parent 288a6ac commit 80122d9

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

content/contributing/documentation/rst_cheat_sheet.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,21 @@ Use the `command` markup to highlight a command.
216216
Icons
217217
-----
218218

219-
Use the `icon` markup to add a class name of an icon. The icon set used is *Font Awesome*. It is
220-
recommended to accompany an icon with a :ref:`contributing/markups/guilabel` as a descriptor,
221-
however, it is not mandatory.
219+
Use the `icon` markup to add a class name of an icon. There are two icon sets used in Odoo:
220+
`FontAwesome4 <https://fontawesome.com/v4/icons/>`_ and :doc:`Odoo UI
221+
</developer/reference/user_interface/icons>`. It is recommended to accompany an icon with a
222+
:ref:`contributing/markups/guilabel` as a descriptor, however, it is not mandatory.
222223

223224
.. list-table::
224225
:class: o-showcase-table
225226

226-
* - The graph view is represented by the :icon:`fa-bar-chart` :guilabel:`(bar chart)` icon.
227+
* - The graph view is represented by the :icon:`fa-area-chart` :guilabel:`(area chart)` icon. The
228+
pivot view is represented by the :icon:`oi-view-pivot` icon.
227229

228230
* - .. code-block:: text
229231

230-
The graph view is represented by the :icon:`fa-bar-chart` :guilabel:`(bar chart)` icon.
232+
The graph view is represented by the :icon:`fa-area-chart` :guilabel:`(area chart)` icon.
233+
The pivot view is represented by the :icon:`oi-view-pivot` icon.
231234

232235
.. _contributing/lists:
233236

extensions/odoo_theme/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ def _set_docname_as_class(_reference_node, _node_docname):
115115
def icon_role(name, rawtext, text, lineno, inliner, options=None, content=None):
116116
""" Implement an `icon` role for Odoo and Font Awesome icons. """
117117
for icon_class in text.split():
118-
if not icon_class.startswith('fa-'):
118+
if not (icon_class.startswith('fa-') or icon_class.startswith('oi-')):
119119
report_error = inliner.reporter.error(
120120
f"'{icon_class}' is not a valid icon formatting class.", lineno=lineno
121121
)
122122
error_node = inliner.problematic(rawtext, rawtext, report_error)
123123
return [error_node], [report_error]
124-
icon_html = f'<i class="{text}"></i>'
124+
icon_html = f'<i class="oi {text}"></i>' if text.startswith('oi-') else f'<i class="{text}"></i>'
125125
node = nodes.raw('', icon_html, format='html')
126126
return [node], []

0 commit comments

Comments
 (0)
0