Пример #1
0
def version_detail(context,
                   addon,
                   version,
                   src,
                   impala=False,
                   itemclass='item'):
    return new_context(**locals())
Пример #2
0
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)
Пример #3
0
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)))
Пример #4
0
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)))
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
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))
Пример #8
0
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))
Пример #9
0
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)
Пример #10
0
def collection_grid(context, collections, src=None, pagesize=4, cols=2):
    pages = chunked(collections, pagesize)
    columns = 'cols-%d' % cols
    return new_context(**locals())
Пример #11
0
def collection_grid(context, collections, src=None, pagesize=4, cols=2):
    pages = chunked(collections, pagesize)
    columns = 'cols-%d' % cols
    return new_context(**locals())
Пример #12
0
def mobile_version_detail(context, addon, version, src):
    return new_context(**locals())
Пример #13
0
def dev_addon_listing_items(context, addons, src=None, notes=None):
    if notes is None:
        notes = {}
    return new_context(**locals())
Пример #14
0
def version_detail(context, addon, version, src, impala=False,
                   skip_contrib=False, itemclass='item'):
    return new_context(**locals())
Пример #15
0
def mobile_version_detail(context, addon, version, src):
    return new_context(**locals())
Пример #16
0
def dev_addon_listing_items(context, addons, src=None, notes=None):
    if notes is None:
        notes = {}
    return new_context(**locals())
Пример #17
0
def dev_addon_listing_items(context, addons, src=None, notes={}):
    return new_context(**locals())
Пример #18
0
def dev_addon_listing_items(context, addons, src=None, notes={}):
    return new_context(**locals())