def version_detail(context, addon, version, src, impala=False, itemclass='item'): return new_context(**locals())
def add_file_modal(context, title, action, action_label, modal_type='file'): addon = context['addon'] upload_url = reverse('devhub.upload_for_addon', args=[addon.slug]) return new_context(modal_type=modal_type, context=context, title=title, action=action, upload_url=upload_url, action_label=action_label)
def reviewers_score_bar(context, types=None, addon_type=None): user = context.get('user') return new_context(dict( request=context.get('request'), amo=amo, settings=settings, points=ReviewerScore.get_recent(user, addon_type=addon_type), total=ReviewerScore.get_total(user), **ReviewerScore.get_leaderboards(user, types=types, addon_type=addon_type)))
def add_file_modal(context, title, action, action_label, modal_type='file'): addon = context['addon'] version = context.get('version', addon.find_latest_version_including_rejected()) if version: channel = ('listed' if version.channel == amo.RELEASE_CHANNEL_LISTED else 'unlisted') else: # short term fix - this function won't be used after new file upload. channel = 'listed' if addon.is_listed else 'unlisted' upload_url = reverse('devhub.upload_for_version', args=[addon.slug, channel]) return new_context(modal_type=modal_type, context=context, title=title, action=action, upload_url=upload_url, action_label=action_label)
def add_file_modal(context, title, action, action_label, modal_type='file'): addon = context['addon'] version = context.get('version', addon.find_latest_version_including_rejected(None)) if version: channel = ('listed' if version.channel == amo.RELEASE_CHANNEL_LISTED else 'unlisted') else: # short term fix - this function won't be used after new file upload. channel = 'listed' if addon.is_listed else 'unlisted' upload_url = reverse('devhub.upload_for_version', args=[addon.slug, channel]) return new_context(modal_type=modal_type, context=context, title=title, action=action, upload_url=upload_url, action_label=action_label)
def all_distinct_files(context, version): """Only display a file once even if it's been uploaded for several platforms.""" # hashes_to_file will group files per hash: # {<file.hash>: [<file>, 'Windows / Mac OS X']} hashes_to_file = {} for file_ in version.all_files: display_name = force_text(amo.PLATFORMS[file_.platform].name) if file_.hash in hashes_to_file: hashes_to_file[file_.hash][1] += ' / ' + display_name else: hashes_to_file[file_.hash] = [file_, display_name] return new_context(dict( # We don't need the hashes in the template. distinct_files=hashes_to_file.values(), amo=context.get('amo'), addon=context.get('addon'), show_diff=context.get('show_diff'), version=version))
def collection_grid(context, collections, src=None, pagesize=4, cols=2): pages = chunked(collections, pagesize) columns = 'cols-%d' % cols return new_context(**locals())
def mobile_version_detail(context, addon, version, src): return new_context(**locals())
def dev_addon_listing_items(context, addons, src=None, notes=None): if notes is None: notes = {} return new_context(**locals())
def version_detail(context, addon, version, src, impala=False, skip_contrib=False, itemclass='item'): return new_context(**locals())
def dev_addon_listing_items(context, addons, src=None, notes={}): return new_context(**locals())