Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add docs about navigation
Anna Siwikeec66af75f88
diff --git a/docs/architecture.rst b/docs/architecture.rstindex 571c08c088..215ad4f395 100644--- a/docs/architecture.rst+++ b/docs/architecture.rst@@ -11,5 +11,6 @@ Architecturearchitecture/i18narchitecture/searcharchitecture/payments+ architecture/navigationarchitecture/settingsarchitecture/pagediff --git a/docs/architecture/navigation.rst b/docs/architecture/navigation.rstnew file mode 100644index 0000000000..fddc294747--- /dev/null+++ b/docs/architecture/navigation.rst@@ -0,0 +1,20 @@+Navigation+==========++Saleor gives a possibility to configure storefront navigation. It can be done in dashboard ``Navigation`` tab.++You can add up to 3 levels of menu items inside every menu you create. Each menu item can point to an internal page with Category, Collection or Page, or an external website by passing an extra URL.+++Rendering+---------++Menu is rendered in templates by passing to a ``menu`` templatetag a list of available menus (attached with context processor) and menu slug, as shown below.++.. code-block:: html++ {% menu menus 'footer' %}++Menu is rendered as a vertical list by default. You can change it by passing an extra ``horizontal=True`` argument.++By default, storefront template renders menu with slug ``navbar`` as a main navigation bar and with slug ``footer`` as a footer menu.diff --git a/saleor/core/context_processors.py b/saleor/core/context_processors.pyindex 29d4872e2b..937aca069a 100644--- a/saleor/core/context_processors.py+++ b/saleor/core/context_processors.py@@ -20,9 +20,8 @@ def default_currency(request):# request is a required parameter# pylint: disable=W0613def navigation(request):- slugs = ['navbar', 'footer']- kwargs = ['items', 'items__collection', 'items__category', 'items__page']- menus = Menu.objects.prefetch_related(*kwargs).filter(slug__in=slugs)+ menus = Menu.objects.prefetch_related(+ 'items', 'items__collection', 'items__category', 'items__page').all()return {'menus': list(menus)}