Exemplo n.º 1
0
def board(board_id):
    """
    Returns all the lists of the board specified by board_id.
    """
    lists = List.get_lists_by_board_id(board_id)
    lists = map(lambda x: x.to_dict(), lists)
    return ok({'lists': lists})
Exemplo n.º 2
0
def board_lists(board_id):
    """
    Returns all the lists belongs to the board specified by board id.
    """
    if not Board.has_access_to(g.user.netid, board_id):
        return error(Error.NO_ACCESS_TO_BOARD)

    lists = List.get_lists_by_board_id(board_id)
    return ok({"lists": map(lambda x: x.to_dict(), lists)})
Exemplo n.º 3
0
def board_list(board_id):
    """
    GET: get all lists of the specified board
    POST: add a list to the specified board

    Return JSON.
    """
    if request.method == 'GET':
        lists = List.get_lists_by_board_id(board_id)
        return ok({"lists": map(lambda x: x.to_dict(), lists)})
    elif request.method == 'POST':
        name = request.form.get("name")
        if not name:
            return error(Error.EMPTY_LIST_NAME, 400)

        if not Board.has_access_to(g.user.netid, board_id):
            return error(Error.NO_ACCESS_TO_BOARD, 400)

        list_ = List.add_list(board_id, name)
        return ok({"created": True, "list": list_.to_dict()})
Exemplo n.º 4
0
def board_page(board_id):
    if not Board.has_access_to(g.user.netid, board_id):
        return render_template("no_access.html")
    lists = List.get_lists_by_board_id(board_id)
    return render_template("board_page.html", lists=lists)