Esempio n. 1
0
def reviewers_breadcrumbs(context, queue=None, items=None):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools'
    breadcrumbs.

    **queue**
        Explicit queue type to set.
    **items**
        list of [(url, label)] to be inserted after Add-on.
    """
    crumbs = [(reverse('reviewers.home'), _('Reviewer Tools'))]

    if queue:
        queues = {
            'pending': _('Apps'),
            'rereview': _('Re-reviews'),
            'updates': _('Updates'),
            'escalated': _('Escalations'),
            'moderated': _('Moderated Reviews'),
            'reviewing': _('Reviewing'),
            'themes': _('Themes')
        }

        if items:
            url = reverse('reviewers.apps.queue_%s' % queue)
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, queues[queue]))

    if items:
        crumbs.extend(items)
    return impala_breadcrumbs(context, crumbs, add_default=True)
Esempio n. 2
0
def reviewers_breadcrumbs(context, queue=None, items=None):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools'
    breadcrumbs.

    **queue**
        Explicit queue type to set.
    **items**
        list of [(url, label)] to be inserted after Add-on.
    """
    crumbs = [(reverse('reviewers.home'), _('Reviewer Tools'))]

    if queue:
        queues = {'pending': _('Apps'),
                  'rereview': _('Re-reviews'),
                  'escalated': _('Escalations')}

        if items:
            url = reverse('reviewers.apps.queue_%s' % queue)
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, queues[queue]))

    if items:
        crumbs.extend(items)
    return impala_breadcrumbs(context, crumbs, add_default=True)
Esempio n. 3
0
def reviewers_breadcrumbs(context, queue=None, addon_queue=None, items=None):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools'
    breadcrumbs.

    **items**
        list of [(url, label)] to be inserted after Add-on.
    **addon_queue**
        Addon object. This sets the queue by addon type or addon status.
    **queue**
        Explicit queue type to set.
    """
    crumbs = [(reverse('reviewers.home'), _('Reviewer Tools'))]

    if addon_queue and addon_queue.type == amo.ADDON_WEBAPP:
        queue = 'pending'

    if queue:
        queues = {'pending': _('Apps')}

        if items and not queue == 'queue':
            url = reverse('reviewers.apps.queue_%s' % queue)
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, queues[queue]))

    if items:
        crumbs.extend(items)
    return impala_breadcrumbs(context, crumbs, add_default=True)
Esempio n. 4
0
def reviewers_breadcrumbs(context, queue=None, addon_queue=None, items=None):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools'
    breadcrumbs.

    **items**
        list of [(url, label)] to be inserted after Add-on.
    **addon_queue**
        Addon object. This sets the queue by addon type or addon status.
    **queue**
        Explicit queue type to set.
    """
    crumbs = [(reverse('reviewers.home'), _('Reviewer Tools'))]

    if addon_queue and addon_queue.type == amo.ADDON_WEBAPP:
        queue = 'pending'

    if queue:
        queues = {'pending': _('Apps')}

        if items and not queue == 'queue':
            url = reverse('reviewers.apps.queue_%s' % queue)
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, queues[queue]))

    if items:
        crumbs.extend(items)
    return impala_breadcrumbs(context, crumbs, add_default=True)
Esempio n. 5
0
def reviewers_breadcrumbs(context, queue=None, items=None):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools'
    breadcrumbs.

    **queue**
        Explicit queue type to set.
    **items**
        list of [(url, label)] to be inserted after Add-on.
    """
    crumbs = [(reverse("reviewers.home"), _("Reviewer Tools"))]

    if queue:
        queues = {
            "pending": _("Apps"),
            "rereview": _("Re-reviews"),
            "updates": _("Updates"),
            "escalated": _("Escalations"),
            "device": _("Device"),
            "moderated": _("Moderated Reviews"),
            "reviewing": _("Reviewing"),
            "region": _("Regional Queues"),
        }

        if items:
            url = reverse("reviewers.apps.queue_%s" % queue)
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, queues[queue]))

    if items:
        crumbs.extend(items)
    return impala_breadcrumbs(context, crumbs, add_default=True)
Esempio n. 6
0
def dev_breadcrumbs(context,
                    addon=None,
                    items=None,
                    add_default=False,
                    impala=False):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Developer Hub'
    breadcrumbs.

    **items**
        list of [(url, label)] to be inserted after Add-on.
    **addon**
        Adds the Add-on name to the end of the trail.  If items are
        specified then the Add-on will be linked.
    **add_default**
        Prepends trail back to home when True.  Default is False.
    **impala**
        Whether to use the impala_breadcrumbs helper. Default is False.
    """
    if context.get('webapp'):
        crumbs = []
        title = _('My Apps')
        link = reverse('devhub.apps')
    else:
        crumbs = [(reverse('devhub.index'), _('Developer Hub'))]
        title = _('My Add-ons')
        link = reverse('devhub.addons')

    if not addon and not items:
        # We are at the end of the crumb trail.
        crumbs.append((None, title))
    else:
        crumbs.append((link, title))
    if addon:
        if items:
            url = addon.get_dev_url()
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, addon.name))
    if items:
        crumbs.extend(items)

    if len(crumbs) == 1:
        crumbs = []

    if impala:
        return impala_breadcrumbs(context, crumbs, add_default)
    else:
        return breadcrumbs(context, crumbs, add_default)
Esempio n. 7
0
def dev_breadcrumbs(context, addon=None, items=None, add_default=False,
                    impala=False):
    """
    Wrapper function for ``breadcrumbs``. Prepends 'Developer Hub'
    breadcrumbs.

    **items**
        list of [(url, label)] to be inserted after Add-on.
    **addon**
        Adds the Add-on name to the end of the trail.  If items are
        specified then the Add-on will be linked.
    **add_default**
        Prepends trail back to home when True.  Default is False.
    **impala**
        Whether to use the impala_breadcrumbs helper. Default is False.
    """
    if context.get('webapp'):
        crumbs = []
        title = _('My Apps')
        link = reverse('devhub.apps')
    else:
        crumbs = [(reverse('devhub.index'), _('Developer Hub'))]
        title = _('My Add-ons')
        link = reverse('devhub.addons')

    if not addon and not items:
        # We are at the end of the crumb trail.
        crumbs.append((None, title))
    else:
        crumbs.append((link, title))
    if addon:
        if items:
            url = addon.get_dev_url()
        else:
            # The Addon is the end of the trail.
            url = None
        crumbs.append((url, addon.name))
    if items:
        crumbs.extend(items)

    if len(crumbs) == 1:
        crumbs = []

    if impala:
        return impala_breadcrumbs(context, crumbs, add_default)
    else:
        return breadcrumbs(context, crumbs, add_default)