diff --git a/src/anki_creator_flask/mainapp.py b/src/anki_creator_flask/mainapp.py index 8c6a2a0..dded626 100644 --- a/src/anki_creator_flask/mainapp.py +++ b/src/anki_creator_flask/mainapp.py @@ -59,12 +59,19 @@ def file_list(listing_path=""): if request.method == "POST": form = request.form.to_dict() listing_path = Path(listing_path) - process_file = ProcessFile(listing_path) - if process_file.absolute_input_file.is_file(): - listing_path = listing_path.parent - return redirect( - (url_for("mainapp.create", listing_path=listing_path / form["name"])) - ) + path = listing_path / form['name'] + if form['type'] == "folder": + api.create_folder(path) + return redirect( + (url_for("mainapp.file_list", listing_path=path)) + ) + elif form['type'] == "file": + process_file = ProcessFile(listing_path) + if process_file.absolute_input_file.is_file(): + listing_path = listing_path.parent + return redirect( + (url_for("mainapp.create", listing_path=path)) + ) @mainapp.route("/download/", methods=["GET"]) diff --git a/src/anki_creator_flask/templates/file_list.html b/src/anki_creator_flask/templates/file_list.html index 1e59bc4..b6deeda 100644 --- a/src/anki_creator_flask/templates/file_list.html +++ b/src/anki_creator_flask/templates/file_list.html @@ -112,12 +112,19 @@
  • +
    + + + + +
    +