% from "templates/macros/icons.html" import icon with context % macro nav(items, base='') % set current = request.path.raw[len(base):].strip('/') % for item in items % set slug = item[0].strip('/') % set options = item[2] if len(item) > 2 else {} % set icon = options.get('icon') or '' % set dropdown = options.get('dropdown') % set subnav = options.get('subnav') % set togglable = options.get('togglable') % set active = ( current == slug or slug and current.startswith(slug) and (togglable or not subnav) ) % set classes = (options.get('class') or '') + (' active' if active else '') % if dropdown % set button_extra_cls = 'dropdown-toggle-form' if options.get('form') else '' % elif subnav % if togglable % else {{ icon }} {{ item[1] }} % endif % elif slug != None {{ icon }} {{ item[1] }} % else {{ icon }} {{ item[1] }} % endif % endfor % endmacro % macro nav_about() {{ nav([ ('/', _('Introduction')), ('/faq', _('FAQ')), ('/global', _('Global')), ('/payment-processors', _('Payment Processors')), ('/teams', _('Teams')), ('/stats', _('Stats')), ('/legal', _('Legal')), ('/privacy', _('Privacy')), ('/feeds', _('Follow Us')), ('/contact', _('Contact')), ('/security', _('Security')), ('/logos', _('Logos')), ], base='/about') }} % endmacro % macro nav_admin() {{ nav([ ('/', icon('index', "Index")), ('/admins', "Audit Log"), ('/cron', "Cron Jobs"), ('/debug', "Debugging"), ('/emails', "Email Addresses"), ('/email-domains', "Email Domains"), ('/notifications', "Notifications"), ('/payday', "Payday"), ('/payments', "Payments"), ('/rate-limiting', "Rate Limiting"), ('/schedules', "Schedules"), ('/users', "Users"), ], base='/admin') }} % endmacro % macro nav_explore() {{ nav([ ('/', _('Overview')), ('/recipients', _('Recipients')), ('/hopefuls', _('Hopefuls')), ('/pledges', _('Unclaimed Donations')), ('/repositories', _('Repositories')), ('/elsewhere', _('Social Networks')), ], base='/explore') }} % endmacro % macro nav_settings(participant) % set base = '/'+participant.username {{ nav(([ ('/edit', _("Profile"), { 'subnav': nav([ ('/username', _("Name")), ('/avatar', _("Avatar")), ('/currencies', _("Currencies")), ('/countries', _("Countries")), ('/goal', _("Goal")), ('/statement', _("Descriptions")), ('/elsewhere', _("Linked Accounts")), ('/repositories', _("Repositories")), ('/teams', _("Teams")), ('/privacy', _("Privacy")) ], base=participant.path('edit')), 'togglable': True, }), ('/giving/', _("Giving"), { 'subnav': nav([ ('/routes/', _("Instruments")), ('/giving/schedule', _("Schedule")), ], base=base) }), ('/receiving/', _("Receiving"), { 'subnav': nav([ ('/patrons/', _("Patrons")), ('/payment/', _("Payment Processors")), ], base=base) }), ('/ledger/', _("Ledger")), ('/identity', _("Identity")), ('/settings/', _("Account")), ('/emails/', _("Emails")), ('/notifications/', _("Notifications")), ('/widgets/', _("Widgets")), ] if participant.is_person else [ ('/edit', _("Profile"), { 'subnav': nav([ ('/username', _("Name")), ('/avatar', _("Avatar")), ('/currencies', _("Currencies")), ('/goal', _("Goal")), ('/statement', _("Descriptions")), ('/elsewhere', _("Linked Accounts")), ('/repositories', _("Repositories")), ('/members', _("Members")), ('/privacy', _("Privacy")), ], base=participant.path('edit')), 'togglable': True, }), ('/receiving/', _("Receiving"), { 'subnav': nav([ ('/patrons/', _("Patrons")), ], base=base) }), ('/emails/', _("Emails")), ('/widgets/', _("Widgets")), ]), base=base) }} % if user.is_acting_as('admin') {{ nav([('/admin', "Admin")], base=base) }} % endif % endmacro % macro querystring_nav(key, values, current, derive=True) % for value, title in values % if derive {{ title }} % else {{ title }} % endif % endfor % endmacro