Navigation
Module reahl.web.bootstrap.navs¶
Examples in this section
(deleted) tutorial.pageflow2bootstrap
Get a copy of an example by running:
reahl example <examplename>
New in version 3.2.
A Bootstrap “Nav” is a navigation menu: a list of items that are links to other Views. Navs can also have a second level so that if you click on an item, a dropdown list of vertically stacked options appear.
This module contains the necessary Widgets and Layouts to create and style Bootstrap Navs.
Changed in version 4.0: Moved Menu here from reahl.web.ui.
Changed in version 4.0: Removed the .add_item and add_submenu methods in favour of .add_a,.add_bookmark,.add_dropdown methods.
Nav¶
-
class
reahl.web.bootstrap.navs.
Nav
(view)¶ A Nav is a navigation menu, with items a user can click on to transition to possibly different Views. Individual Items visually indicate whether they are active or disabled.
Note
Don’t be confused
This, the
reahl.web.bootstrap.navs.Nav
is not the same thing as a simple HTML-levelreahl.web.bootstrap.ui.Nav
!- Parameters
view – (See
Widget
)
-
add_dropdown
(title, dropdown_menu, drop_position='down', query_arguments={})¶ Adds the dropdown_menu
DropdownMenu
to this Nav. It appears as the top-level item with text title.- Parameters
drop_position – Position relative to the item where the dropdown should appear (‘up’, ‘down’, ‘left’ or ‘right’).
query_arguments – (For internal use)
PillLayout¶
-
class
reahl.web.bootstrap.navs.
PillLayout
(stacked=False, content_alignment=None, content_justification=None)¶ This Layout makes a Nav appear as horizontally or vertically arranged pills (buttons).
- Parameters
stacked – If True, the pills are stacked vertically.
content_alignment – If given, changes how content is aligned inside the Nav (default is start) (One of: center, end)
content_justification – If given, makes the content take up all space in the Nav. Either with elements having equal space (fill), or unequal space (justified) (One of: fill, justified)
-
customise_widget
()¶ Override this method in subclasses to allow your Layout to change its Widget upon construction. There is no need to call super(), as the superclass implementation does nothing.
TabLayout¶
-
class
reahl.web.bootstrap.navs.
TabLayout
(content_alignment=None, content_justification=None)¶ This Layout makes a Nav appear as horizontal tabs.
- Parameters
content_alignment – If given, changes how content is aligned inside the Nav (default is start) (One of: center, end)
content_justification – If given, makes the content take up all space in the Nav. Either with elements having equal space (fill), or unequal space (justified) (One of: fill, justified)
DropdownMenu¶
-
class
reahl.web.bootstrap.navs.
DropdownMenu
(view)¶ A second-level menu that can be added to a Nav.
DropdownMenuLayout¶
-
class
reahl.web.bootstrap.navs.
DropdownMenuLayout
(align_right=False)¶ Changes a DropdownMenu alignment.
- Parameters
align_right – If True, align the dropdown to the right side of its parent item, else to the left.
-
customise_widget
()¶ Override this method in subclasses to allow your Layout to change its Widget upon construction. There is no need to call super(), as the superclass implementation does nothing.
Menu¶
-
class
reahl.web.bootstrap.navs.
Menu
(view)¶ A visual menu that lists a number of Views to which the user can choose to go to.
Styling
Rendered as a <ul class=”reahl-menu”> element that contains a <li> for each MenuItem.
- Parameters
view – (See
reahl.web.fw.Widget
)
Changed in version 3.2: Deprecated use of a_list and changed it temporarily to a keyword argument for backwards compatibility.
Changed in version 3.2: Deprecated css_id keyword argument.
Changed in version 3.2: Deprecated the from_xxx methods and added with_xxx replacements to be used after construction.
Changed in version 3.2: Deprecated add_item and replaced it with add_submenu.
Changed in version 3.2: Added a number of add_xxx methods for adding items from different sources.
Changed in version 4.0: Removed deprecated a_list and css_id
-
with_bookmarks
(bookmark_list)¶ Populates this Menu with a MenuItem for each Bookmark given in bookmark_list.
Answers the same Menu.
New in version 3.2.
-
with_languages
()¶ Populates this Menu with a MenuItem for each available language.
Answers the same Menu.
New in version 3.2.
-
with_a_list
(a_list)¶ Populates this Menu with a MenuItem for each
A
in a_list.Answers the same Menu.
New in version 3.2.
-
add_bookmark
(bookmark, active_regex=None)¶ Adds a MenuItem for the given
Bookmark
to this Menu’.Answers the added MenuItem.
New in version 3.2.
-
add_a
(a, active_regex=None, exact_match=None)¶ Adds an
A
as a MenuItem.Answers the added MenuItem.
New in version 3.2.
Table of Contents
Previous topic
Package reahl.web.bootstrap.tables
Next topic
Module reahl.web.bootstrap.navbar