From 7e04e250b010751060e88d5413c8bc825c056c52 Mon Sep 17 00:00:00 2001 From: "Sam Lieber (sali)" Date: Mon, 29 Apr 2024 17:21:10 -0400 Subject: [PATCH] [IMP] extensions: icon_role odoo ui closes odoo/documentation#9252 X-original-commit: a39903ca1234ffed7eec578f34c6891945209701 Signed-off-by: Samuel Lieber (sali) --- .../contributing/documentation/rst_cheat_sheet.rst | 13 ++++++++----- extensions/odoo_theme/__init__.py | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/content/contributing/documentation/rst_cheat_sheet.rst b/content/contributing/documentation/rst_cheat_sheet.rst index 5a6265638..779f140a4 100644 --- a/content/contributing/documentation/rst_cheat_sheet.rst +++ b/content/contributing/documentation/rst_cheat_sheet.rst @@ -216,18 +216,21 @@ Use the `command` markup to highlight a command. Icons ----- -Use the `icon` markup to add a class name of an icon. The icon set used is *Font Awesome*. It is -recommended to accompany an icon with a :ref:`contributing/markups/guilabel` as a descriptor, -however, it is not mandatory. +Use the `icon` markup to add a class name of an icon. There are two icon sets used in Odoo: +`FontAwesome4 `_ and :doc:`Odoo UI +`. It is recommended to accompany an icon with a +:ref:`contributing/markups/guilabel` as a descriptor, however, it is not mandatory. .. list-table:: :class: o-showcase-table - * - The graph view is represented by the :icon:`fa-bar-chart` :guilabel:`(bar chart)` icon. + * - The graph view is represented by the :icon:`fa-area-chart` :guilabel:`(area chart)` icon. The + pivot view is represented by the :icon:`oi-view-pivot` icon. * - .. code-block:: text - The graph view is represented by the :icon:`fa-bar-chart` :guilabel:`(bar chart)` icon. + The graph view is represented by the :icon:`fa-area-chart` :guilabel:`(area chart)` icon. + The pivot view is represented by the :icon:`oi-view-pivot` icon. .. _contributing/lists: diff --git a/extensions/odoo_theme/__init__.py b/extensions/odoo_theme/__init__.py index ab9ff8a67..49d40a001 100644 --- a/extensions/odoo_theme/__init__.py +++ b/extensions/odoo_theme/__init__.py @@ -115,12 +115,12 @@ def resolve(old_resolve, tree, docname, *args, **kwargs): def icon_role(name, rawtext, text, lineno, inliner, options=None, content=None): """ Implement an `icon` role for Odoo and Font Awesome icons. """ for icon_class in text.split(): - if not icon_class.startswith('fa-'): + if not (icon_class.startswith('fa-') or icon_class.startswith('oi-')): report_error = inliner.reporter.error( f"'{icon_class}' is not a valid icon formatting class.", lineno=lineno ) error_node = inliner.problematic(rawtext, rawtext, report_error) return [error_node], [report_error] - icon_html = f'' + icon_html = f'' if text.startswith('oi-') else f'' node = nodes.raw('', icon_html, format='html') return [node], []