Пример #1
0
def get_children(request, translation_project, directory):
    """Returns a list of children directories and stores for this
    ``directory``, and also the parent directory.

    The elements of the list are dictionaries which keys are populated after
    in the templates.
    """

    is_terminology = translation_project.project.is_terminology

    parent = []
    parent_dir = directory.parent

    if not (parent_dir.is_language() or parent_dir.is_project()):
        parent = [{'title': u'..', 'href': parent_dir}]

    directories = [
        item_dict.make_directory_item(request,
                                      child_dir,
                                      include_suggestions=True,
                                      terminology=is_terminology)
        for child_dir in directory.child_dirs.iterator()
    ]

    stores = [
        item_dict.make_store_item(request,
                                  child_store,
                                  include_suggestions=True,
                                  terminology=is_terminology)
        for child_store in directory.child_stores.iterator()
    ]

    return parent + directories + stores
Пример #2
0
def get_children(request, translation_project, directory):
    """Returns a list of children directories and stores for this
    ``directory``, and also the parent directory.

    The elements of the list are dictionaries which keys are populated after
    in the templates.
    """

    is_terminology = translation_project.project.is_terminology

    parent = []
    parent_dir = directory.parent

    if not (parent_dir.is_language() or parent_dir.is_project()):
        parent = [{'title': u'..', 'href': parent_dir}]

    directories = [item_dict.make_directory_item(request, child_dir,
                                                 include_suggestions=True,
                                                 terminology=is_terminology)
                   for child_dir in directory.child_dirs.iterator()]

    stores = [item_dict.make_store_item(request, child_store,
                                        include_suggestions=True,
                                        terminology=is_terminology)
              for child_store in directory.child_stores.iterator()]

    return parent + directories + stores
Пример #3
0
def get_children(request, translation_project, directory, links_required=None):

    is_terminology = translation_project.project.is_terminology

    return [item_dict.make_directory_item(request, child_dir, links_required=links_required, terminology=is_terminology)
            for child_dir in directory.child_dirs.iterator()] + \
           [item_dict.make_store_item(request, child_store, links_required=links_required, terminology=is_terminology)
            for child_store in directory.child_stores.iterator()]
Пример #4
0
def make_directory_navbar_dict(request, directory, terminology=False):
    result = item_dict.make_directory_item(request, directory, terminology)
    project_url = request.translation_project.directory.pootle_path
    path_links = make_directory_pathlinks(project_url, directory.pootle_path, [])

    result.update({'path': make_navbar_path_dict(request, path_links)})
    del result['title']
    return result
Пример #5
0
def get_children(request, translation_project, directory, links_required=None):

    is_terminology = translation_project.project.is_terminology

    return [item_dict.make_directory_item(request, child_dir, links_required=links_required, terminology=is_terminology)
            for child_dir in directory.child_dirs.iterator()] + \
           [item_dict.make_store_item(request, child_store, links_required=links_required, terminology=is_terminology)
            for child_store in directory.child_stores.iterator()]
Пример #6
0
def make_directory_navbar_dict(request, directory, terminology=False):
    result = item_dict.make_directory_item(request, directory, terminology)
    project_url = request.translation_project.directory.pootle_path
    path_links = make_directory_pathlinks(project_url, directory.pootle_path,
                                          [])

    result.update({'path': make_navbar_path_dict(request, path_links)})
    del result['title']
    return result
Пример #7
0
def make_directory_navbar_dict(request, directory, links_required=None):
    result = item_dict.make_directory_item(request, directory, links_required)
    project_url = request.translation_project.directory.pootle_path
    path_links = make_directory_pathlinks(request, project_url, directory.pootle_path, [])
    if links_required:
        actions = make_directory_actions(request, links_required)
    else:
        actions = []
    result.update({
            'path':    make_navbar_path_dict(request, path_links),
            'actions': actions })
    del result['title']
    return result
def make_directory_navbar_dict(request, directory, links_required=None):
    result = item_dict.make_directory_item(request, directory, links_required)
    project_url = request.translation_project.directory.pootle_path
    path_links = make_directory_pathlinks(request, project_url, directory.pootle_path, [])
    if links_required:
        actions = make_directory_actions(request, links_required)
    else:
        actions = []
    result.update({
            'path': make_navbar_path_dict(request, path_links),
            'actions': actions})
    del result['title']
    return result