reviewboard.datagrids.sidebar¶
Bases:
object
Base class for an item on the sidebar of a datagrid.
Items can optionally have labels and counts associated with them. Depending on the subclass, it may also be able to nest items.
They may also have custom templates, for more advanced rendering.
See SidebarItem and BaseSidebarSection for the common types of sidebar items.
Initialize the sidebar item.
Return the URL used when clicking the item.
By default, this builds a URL to the parent datagrid using the
view_id
andview_args
attributes. If they are not set, then the item won’t be clickable.
Return the count shown for this item.
By default, this shows nothing. Subclasses can override to display a count.
Return whether the item is visible.
By default, an item is visible. Subclasses can override this to control visibility.
Return whether the item is currently active.
The item will be active if the current page matches the URL associated with the item.
Render the item.
Return extra context for the render.
Bases:
reviewboard.datagrids.sidebar.BaseSidebarItem
Base class for a section of items on the sidebar.
Subclasses can override this to define a section and provide items listed in the section.
Sections can optionally be clickable and display a count.
Initialize the section.
Return the items displayed in this section.
Subclasses must override this and return or yield the items to be displayed.
Return whether the section is visible.
By default, a section is visible if it has any item classes registered.
Return extra context for the section.
Bases:
reviewboard.datagrids.sidebar.BaseSidebarItem
A typical navigation link item on the sidebar.
This is the standard type of item added to sections on a sidebar. It will automatically generate a link to the dashboard view matching
view_id
andview_args
, and display the provided count.Initialize the item.
Return the URL for the item.
Return the count provided in the constructor.
Bases:
object
Provides a sidebar for a datagrid.
A sidebar can have several item classes added to it of various types. These will be instantiated and rendered when rendering the datagrid.
Initialize the sidebar.
Add an item class to the sidebar.
Remove an item class from the sidebar.
Instantiate and returns all items on the sidebar.
Bases:
object
A mixin for datagrids using a sidebar.
This is meant to be used along with Sidebar. It will initialize the sidebar, providing instances of all the items for the template.
Compute any extra state for the sidebar.