• Logo
    Launchpad Manual
  • launchpad.net
  • Submit a Bug
  • Help
Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Launchpad Manual documentation
  • Tutorials
    • Creating a new page in Launchpad
    • Creating a Rock build using APIs
  • How-to Guides
    • Getting started
      • Getting the source code
      • Setting up and running Launchpad (Quickstart)
      • Setting up and running Launchpad (Advanced)
      • Launchpad Database Setup
      • How to develop with Buildd
      • How to use Soyuz locally
    • Common development tasks
      • Fixing Bugs
      • Contributing changes
      • Using an updated dependency
      • Database schema changes process
      • Applying database schema changes
      • Importing an Ubuntu package
    • Launchpad development tips
      • Updating the global configuration for tests
      • Using breakpoints
      • Handling security policies
      • Testing CLI scripts
      • Handling exceptions
      • Preserving query count
      • Running Launchpad with Chameleon Template Engine
      • Debug Tests with Visual Studio Code
      • Debug Build Farm on qastaging
      • Debug Stories/Pagetests
      • Launchpad API Docs generation
      • How To Use Codehosting Locally
      • Renaming a Database Table
    • Operating Launchpad
      • Getting an overview of Launchpad’s build farm
      • Checking availability of Launchpad frontends
      • Manage users and teams in development environments
      • Create job to publish artifact
      • Triaging Launchpad project bugs
      • Deploying configuration changes to production
      • Landing updates for Loggerhead
      • Transferring ownership of a Launchpad project
      • Creating bot account in Launchpad
      • Porting builders to newer Ubuntu versions
      • Applying a cowboy to qastaging
      • Building and publishing Launchpad Development LXD Images
      • How to Use lp-shell
  • Reference
    • Python style guide
    • Tests style guide
    • CSS style guide
    • Build farm
    • Signing service
    • Fetch service
    • Buildbot
    • Automatic translations tarball exports
    • Mirror prober
    • Git hosting
    • Code import
    • Launchpad and email
  • Explanation
    • The ideas behind Launchpad
      • What is Launchpad?
      • Launchpad strategy
      • Launchpad values
      • About Launchpad security
    • Setting up and understanding Launchpad
      • Launchpad installation details
      • Application framework
      • Navigating the tree
      • Launchpad pip integration
      • The Launchpad PPA
      • Testing
      • Code Concepts
    • Best practices for development
      • Architectural guide
      • Charm development
      • Code import in depth
      • About Launchpad performance
      • Template reuse
      • Launchpad permissions
    • Developing the Launchpad project
      • About Launchpad branches
      • Pre merge reviews
      • Error explanations
      • Hacking
      • Feature Flags
      • Datetime Usage Guide
      • XXX policy
    • Parts of Launchpad
      • Navigation menus
      • Launchpad Mail
      • URL Traversal
      • About Malone
      • Launchpad Registry
      • Engineering Overview: Translations
      • Launchpad Code Hosting
    • JavaScript
      • Integration Testing in JavaScript
      • Developing with YUI.Test
      • The Launchpad JavaScript Build System
    • Static Assets
      • CSS
      • Using CSS sprites
      • Images
      • Favicons: Why so many files and what do they do?
    • Database
      • PostgreSQL and Launchpad
      • Working with db-devel
      • Live Database Patching
      • Storm Migration Guide
      • Database performance
  • Getting Help
  • Release Notes
  • Contribute to our docs
Back to top
View this page

Navigation menus¶

Important

This document has been migrated from our old wiki as is, and has not yet been revised. The content might be outdated, links and images could be broken. We are aware and will fix any issues as soon as possible.

When linking different views in Launchpad page templates it is recommend to use the NavigationMenu attached to each facet of that object.

The NavigationMenus are defined in the browser code.

An object can have multiple facets. For example IPerson has a ‘code’, ‘overview’, ‘translation’ .. etc facets.

Here is a definition of the IPerson navigation menu for translations facet.

class IPersonTranslationsMenu(NavigationMenu):

    usedfor = IPerson
    facet = 'translations'
    links = ['translations', 'imports']

    def translations(self):
        return Link('', 'Overview')

    @enabled_with_permission('launchpad.Edit')
    def imports(self):
        return Link('+imports', 'Import queue', icon='edit')

An

Link('', 'Some text')

will only return the text without the anchor tag.

From withing a page template, you can use the following TAL expression to generate a link:

person_object/menu:translations/imports/render

or you can get only the URL using

person_object/menu:translations/imports/url

In the current codebase you may encounter the following code which is not recommended:

<div tal:condition="context/required:launchpad.Edit">
  <a href="+imports" class="edit sprite">Import queue</a>
</div>

Instead you should use:

<div tal:condition="context/required:launchpad.Edit">
  <a tal:attributes="href context/menu:navigation/imports/url" class="edit sprite">Import queue</a>
</div>

Or better:

<a tal:replace="structure context/menu:navigation/imports/render" />

In the above code you can use either context/menu:navigation/imports or context/menu:translations/imports. menu:navigation is using the same facet associated with the current view.

Copyright © 2023, Canonical Group Ltd
Last updated on May 28, 2025
Show source
Open a GitHub issue for this page
Edit this page on GitHub
Contents
  • Navigation menus