I want to be able to attach a menu to a specific page...right?

Bug #1515 reported by Brad Bollenbach
6
Affects Status Importance Assigned to Milestone
Launchpad itself
Invalid
Medium
Steve Alexander

Bug Description

I've got this page:

    http://localhost:8086/distros/debian/+filebug

on which I want to drape a set of Malone menu tabs. I attempted to start defining this menu like this (untested):

class FileBugFormMenu(BugTaskSubsetMenu):
    """Malone application menu when filing a bug."""

    usedfor = IBugAddForm

    def context_bugs(self):
        context_title = self.context.title
        buglist_url = self._get_context_canonical_url() + "/+bugs"

        return Link(
            target=buglist_url, text="%s Bugs" % context_title,
            summary="Bugs in %s" % context_title)

    def filebug(self):
        context_title = self.context.title
        filebug_url = self._get_context_canonical_url() + "/+filebug"

        return Link(
            target=filebug_url, text="Report a Bug",
            summary="Report a Bug in %s" % context_title)

    def showreports(self):
        context_title = self.context.context.title
        bugs_url = self._get_context_canonical_url() + "/+bugs"
        target = bugs_url + "/+advanced"

        return Link(target=target, text="Show Reports",
                    summary="Show Reports for %s" % context_title)

    def _get_context_canonical_url(self):
        """Return the canonical URL of the bug context."""
        return canonical_url(self.context)

Two things then occurred to me:

   1. The context of the +filebug form is an IProduct or an IDistribution, not an IBugAddForm (or something else, but let's ignore the other details for now.)

   2. If I go ahead and correct this, by, say a menu defined on IProduct, I'm going to end up inadvertently adding a menu to:

    http://localhost:8086/products/firefox

which, of course, I don't want to do.

I want to be able to do say "use this menu for the +filebug view" in ZCML, something like, e.g.

    <browser:addform
        name="+filebug"
        for="canonical.launchpad.interfaces.IProduct"
        schema="canonical.launchpad.interfaces.IBugAddForm"
        menu="canonical.launchpad.browser.launchpad.FileBugPageMenu"
        ...

Brad Bollenbach (bradb)
Changed in launchpad:
assignee: nobody → stevea
status: New → Accepted
Revision history for this message
Steve Alexander (stevea) wrote :

You can get the effect you want by adding the link to the application menu for the bugs facet. That is, the menu that is shown only when the bugs facet is selected.

Changed in launchpad:
status: Accepted → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.