def dev_breadcrumbs(context, addon=None, items=None, add_default=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. """ crumbs = [(reverse('devhub.index'), _('Developer Hub'))] if not addon and not items: # We are at the end of the crumb trail. crumbs.append((None, _('My Add-ons'))) else: crumbs.append((reverse('devhub.addons'), _('My Add-ons'))) if addon: if items: url = reverse('devhub.addons.edit', args=[addon.slug]) else: # The Addon is the end of the trail. url = None crumbs.append((url, addon.name)) if items: crumbs.extend(items) return breadcrumbs(context, crumbs, add_default)
def editors_breadcrumbs(context, queue=None, addon_queue=None, items=None, themes=False): """ 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('editors.home'), _('Editor Tools'))] if themes: crumbs.append((reverse('editors.themes.home'), _('Themes'))) if addon_queue: queue_id = addon_queue.status queue_ids = { amo.STATUS_UNREVIEWED: 'prelim', amo.STATUS_NOMINATED: 'nominated', amo.STATUS_PUBLIC: 'pending', amo.STATUS_LITE: 'prelim', amo.STATUS_LITE_AND_NOMINATED: 'nominated', amo.STATUS_PENDING: 'pending' } queue = queue_ids.get(queue_id, 'queue') if queue: queues = { 'queue': _('Queue'), 'pending': _('Pending Updates'), 'nominated': _('Full Reviews'), 'prelim': _('Preliminary Reviews'), 'moderated': _('Moderated Reviews'), 'fast_track': _('Fast Track'), 'pending_themes': _('Pending Themes'), 'flagged_themes': _('Flagged Themes'), 'rereview_themes': _('Update Themes'), } if items and not queue == 'queue': url = reverse('editors.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 breadcrumbs(context, crumbs, add_default=False)
def mkt_doc_breadcrumbs(context, items=None): """ Wrapper function for `breadcrumbs` for developer docs. """ crumbs = [(reverse("mkt.developers.index"), _("Developer Hub")), (None, _("Developer Docs"))] if items: crumbs.extend(items) return breadcrumbs(context, crumbs, True)
def docs_breadcrumbs(context, items=None): """ Wrapper function for `breadcrumbs` for devhub docs. """ crumbs = [(reverse('devhub.index'), _('Developer Hub')), (None, _('Developer Docs'))] if items: crumbs.extend(items) return breadcrumbs(context, crumbs, True)
def editors_breadcrumbs(context, queue=None, addon_queue=None, items=None, themes=False): """ 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("editors.home"), _("Editor Tools"))] if themes: crumbs.append((reverse("editors.themes.home"), _("Themes"))) if addon_queue: queue_id = addon_queue.status queue_ids = { amo.STATUS_UNREVIEWED: "prelim", amo.STATUS_NOMINATED: "nominated", amo.STATUS_PUBLIC: "pending", amo.STATUS_LITE: "prelim", amo.STATUS_LITE_AND_NOMINATED: "nominated", amo.STATUS_PENDING: "pending", } queue = queue_ids.get(queue_id, "queue") if queue: queues = { "queue": _("Queue"), "pending": _("Pending Updates"), "nominated": _("Full Reviews"), "prelim": _("Preliminary Reviews"), "moderated": _("Moderated Reviews"), "fast_track": _("Fast Track"), "pending_themes": _("Pending Themes"), "flagged_themes": _("Flagged Themes"), "rereview_themes": _("Update Themes"), } if items and not queue == "queue": url = reverse("editors.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 breadcrumbs(context, crumbs, add_default=False)
def editors_breadcrumbs(context, queue=None, addon_queue=None, items=None, themes=False): """ 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('editors.home'), _('Editor Tools'))] if themes: crumbs.append((reverse('editors.themes.home'), _('Themes'))) if addon_queue: queue_id = addon_queue.status queue_ids = {amo.STATUS_UNREVIEWED: 'prelim', amo.STATUS_NOMINATED: 'nominated', amo.STATUS_PUBLIC: 'pending', amo.STATUS_LITE: 'prelim', amo.STATUS_LITE_AND_NOMINATED: 'nominated', amo.STATUS_PENDING: 'pending'} queue = queue_ids.get(queue_id, 'queue') if queue: queues = { 'queue': _('Queue'), 'pending': _('Pending Updates'), 'nominated': _('Full Reviews'), 'prelim': _('Preliminary Reviews'), 'moderated': _('Moderated Reviews'), 'fast_track': _('Fast Track'), 'pending_themes': _('Pending Themes'), 'flagged_themes': _('Flagged Themes'), 'rereview_themes': _('Update Themes'), } if items and not queue == 'queue': url = reverse('editors.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 breadcrumbs(context, crumbs, add_default=False)
def dev_breadcrumbs(context, addon=None, items=None, add_default=False): """ Wrapper function for ``breadcrumbs``. Prepends 'Developer Hub' breadcrumb to ``items`` argument, and ``add_default`` argument defaults to False. Accepts: [(url, label)] """ crumbs = [(reverse('devhub.index'), _('Developer Hub')), (reverse('devhub.addons'), _('My Add-ons'))] if items: crumbs.extend(items) if addon: crumbs.append((None, addon.name)) return breadcrumbs(context, crumbs, add_default)
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)
def editors_breadcrumbs(context, queue=None, queue_id=None, items=None): """ Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools' 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. """ crumbs = [(reverse('editors.home'), _('Editor Tools'))] if queue_id: queue_ids = { 1: 'prelim', 3: 'nominated', 4: 'pending', 8: 'prelim', 9: 'nominated', 2: 'pending' } queue = queue_ids.get(queue_id, 'queue') if queue: queues = { 'queue': _("Queue"), 'pending': _("Pending Updates"), 'nominated': _("Full Reviews"), 'prelim': _("Preliminary Reviews"), 'moderated': _("Moderated Reviews") } if items and not queue == 'queue': url = reverse('editors.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 breadcrumbs(context, crumbs, add_default=False)
def dev_breadcrumbs(context, addon=None, items=None, add_default=False, link_my_addons=True): """ Wrapper function for ``breadcrumbs``. Prepends 'Developer Hub' breadcrumb to ``items`` argument, and ``add_default`` argument defaults to False. Accepts: [(url, label)] addon: adds in a non-linked breadcrumb to the addon link_my_addons: makes "My Add-ons" url linked, defaults to True """ crumbs = [(reverse('devhub.index'), _('Developer Hub')), ] if link_my_addons: crumbs.append((reverse('devhub.addons'), _('My Add-ons'))) else: crumbs.append((None, _('My Add-ons'))) if items: crumbs.extend(items) if addon: crumbs.append((None, addon.name)) return breadcrumbs(context, crumbs, add_default)
def editors_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('editors.home'), _('Editor Tools'))] if addon_queue: if addon_queue.type == amo.ADDON_WEBAPP: queue = 'apps' else: queue_id = addon_queue.status queue_ids = {1: 'prelim', 3: 'nominated', 4: 'pending', 8: 'prelim', 9: 'nominated', 2: 'pending'} queue = queue_ids.get(queue_id, 'queue') if queue: queues = {'queue': _("Queue"), 'pending': _("Pending Updates"), 'nominated': _("Full Reviews"), 'prelim': _("Preliminary Reviews"), 'moderated': _("Moderated Reviews"), 'apps': _("Apps")} if items and not queue == 'queue': url = reverse('editors.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 breadcrumbs(context, crumbs, add_default=False)
def editors_breadcrumbs(context, queue=None, queue_id=None, items=None): """ Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools' 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. """ crumbs = [(reverse("editors.home"), _("Editor Tools"))] if queue_id: queue_ids = {4: "pending", 3: "nominated", 1: "prelim"} queue = queue_ids.get(queue_id, "queue") if queue: queues = { "queue": _("Queue"), "pending": _("Pending Updates"), "nominated": _("Full Reviews"), "prelim": _("Preliminary Reviews"), "moderated": _("Moderated Reviews"), } if items and not queue == "queue": url = reverse("editors.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 breadcrumbs(context, crumbs, add_default=False)
def editors_breadcrumbs(context, queue=None, queue_id=None, items=None): """ Wrapper function for ``breadcrumbs``. Prepends 'Editor Tools' 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. """ crumbs = [(reverse('editors.home'), _('Editor Tools'))] if queue_id: queue_ids = {1: 'prelim', 3: 'nominated', 4: 'pending', 8: 'prelim', 9: 'nominated', 2: 'pending'} queue = queue_ids.get(queue_id, 'queue') if queue: queues = {'queue': _("Queue"), 'pending': _("Pending Updates"), 'nominated': _("Full Reviews"), 'prelim': _("Preliminary Reviews"), 'moderated': _("Moderated Reviews")} if items and not queue == 'queue': url = reverse('editors.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 breadcrumbs(context, crumbs, add_default=False)