def add_file_modal(context, title, action, upload_url, action_label): return new_context(modal_type='file', context=context, title=title, action=action, upload_url=upload_url, action_label=action_label)
def version_detail(context, addon, version, src, show_versions_link=True, itemclass='article'): return new_context(**locals())
def reviewers_score_bar(context): user = context.get('amo_user') return new_context(dict( amo=amo, points=ReviewerScore.get_recent(user), total=ReviewerScore.get_total(user), **ReviewerScore.get_leaderboards(user)))
def add_version_modal(context, title, action, upload_url, action_label): return new_context( modal_type="version", 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'] upload_url = reverse('devhub.upload_for_addon', args=[addon.slug]) upload_url_unlisted = reverse('devhub.upload_for_addon_unlisted', args=[addon.slug]) return new_context(modal_type=modal_type, context=context, title=title, action=action, upload_url=upload_url, upload_url_unlisted=upload_url_unlisted, action_label=action_label)
def reviewers_score_bar(context, types=None): user = context.get('amo_user') return new_context(dict( request=context.get('request'), amo=amo, settings=settings, points=ReviewerScore.get_recent(user), total=ReviewerScore.get_total(user), **ReviewerScore.get_leaderboards(user, types=types)))
def reviewers_score_bar(context, types=None): user = context.get('amo_user') return new_context( dict(request=context.get('request'), amo=amo, settings=settings, points=ReviewerScore.get_recent(user), total=ReviewerScore.get_total(user), **ReviewerScore.get_leaderboards(user, types=types)))
def reviewers_score_bar(context, types=None, addon_type=None): user = context.get("amo_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 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 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 hub_addon_listing_items(context, addons, src=None, notes=None): return new_context(**locals())
def mobile_version_detail(context, addon, version, src): return new_context(**locals())
def version_detail(context, addon, version, src, impala=False, show_versions_link=True, itemclass='article'): return new_context(**locals())
def collection_grid(context, collections, src=None, pagesize=4, cols=2): pages = chunked(collections, pagesize) columns = 'cols-%d' % cols return new_context(**locals())
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 collection_grid(context, collections, src=None, pagesize=4, cols=2): pages = chunked(collections, pagesize) columns = '' if cols != 3 else 'three-col' return new_context(**locals())