def activity_list_navbar(page, user): if user.is_superuser: sections = [navsection(_('Resources'), [ a(_('Student grades'), href='grades.csv'), ])] else: sections = [] return navbar(sections=sections, admin=True, admin_perms='activities.edit_activity', user=user, page=page)
def navsection_page_admin(page, user, links=()): """ Return a list of links for administrative tasks. The default list includes just an edit page. It can be supplemented with additional links. """ pk = page.pk return navsection(_('Settings'), ( a('Edit', href='/admin/pages/%s/edit/' % pk), ) + tuple(links))
def navsection_page_admin(page, user, links=()): """ Return a list of links for administrative tasks. The default list includes just an edit page. It can be supplemented with additional links. """ pk = page.pk return navsection(_('Settings'), (a('Edit', href='/admin/pages/%s/edit/' % pk), ) + tuple(links))
def profile_description(profile, **kwargs): with dl(class_='user-details', **kwargs) as tag: fullname = profile.user.get_full_name() if fullname: tag << [dt(_('Name')), dd(fullname)] if profile.user.email: tag << [dt(_('E-mail')), dd(profile.email)] if profile.age: tag << [dt(_('Age')), dd(str(profile.age))] if profile.website: url = profile.website tag << [dt(_('Website')), dd(a(url, href=url))] if profile.about_me: tag << [dt(_('About me')), dd(markdown(profile.about_me))] return tag
def navsection(title, links, href=None): """ Creates a navsection element. Args: title: Title of the nav section. links: a list of links for this section. href: the optional link for the title element """ title_cls = 'cs-nav__block-title' if href: title = a(class_=title_cls, href=href)[title] else: title = p(class_=title_cls)[title] return nav(class_='cs-nav__block')[ title, ul(class_='cs-nav__block-items')[[li(elem) for elem in links]], ]
def navsection(title, links, href=None): """ Creates a navsection element. Args: title: Title of the nav section. links: a list of links for this section. href: the optional link for the title element """ title_cls = 'cs-nav__block-title' if href: title = a(class_=title_cls, href=href)[title] else: title = p(class_=title_cls)[title] return nav(class_='cs-nav__block')[ title, ul(class_='cs-nav__block-items')[[ li(elem) for elem in links ]], ]
def _head_menu_link(name, link): return li(class_="mdl-menu__item")[a(name, href=link)],