def __init__(self, view): super(AddressBookPage, self).__init__(view) self.use_layout(PageLayout(document_layout=Container())) contents_layout = ColumnLayout(('secondary', ResponsiveSize(md=3)), ('main', ResponsiveSize(md=9))).with_slots() self.layout.contents.use_layout(contents_layout) nav = Nav(view).use_layout(PillLayout(stacked=True)) contents_layout.columns['secondary'].add_child(nav.with_languages())
def __init__(self, view): super(I18nExample, self).__init__(view) menu = Nav(self.view).use_layout(PillLayout()).with_languages() self.add_child(menu) current_url = Url.get_current_url() message = _('This is a translated message. The current URL is "%s".' ) % current_url.path self.add_child(P(view, text=message))
def __init__(self, view): super(HomePage, self).__init__(view) menu = Nav(self.view).use_layout( PillLayout(stacked=True)).with_languages() self.body.add_child(menu) current_url = Url.get_current_url() message = _('This is a translated string. The current URL is "%s".') \ % current_url.path self.body.add_child(P(view, text=message))
def stacked_pill_layouts(self): """Using a PillLayout, you can also make MenuItems appear stacked on top of one another instead of being placed next to one another.""" self.layout_css_class = {'nav-pills', 'flex-column'} self.layout = PillLayout(stacked=True)
def pill_layouts(self): """PillLayouts are used to make Navs MenuItems look almost like buttons.""" self.layout_css_class = {'nav-pills'} self.layout = PillLayout()
def pill_layouts_cannot_mix_justified_and_stacked(fixture): """A PillLayout cannot be both stacked and justified at the same time.""" with expected(ProgrammerError): PillLayout(stacked=True, justified=True)