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})
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)})
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()})
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)