make creation of folder and files
This commit is contained in:
@@ -59,11 +59,18 @@ def file_list(listing_path=""):
|
||||
if request.method == "POST":
|
||||
form = request.form.to_dict()
|
||||
listing_path = Path(listing_path)
|
||||
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=listing_path / form["name"]))
|
||||
(url_for("mainapp.create", listing_path=path))
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -112,12 +112,19 @@
|
||||
<li>
|
||||
<form id="text_form" method="POST">
|
||||
<div class="fields">
|
||||
<div>
|
||||
<input type="radio" id="type1" name="type" value="file" />
|
||||
<label for="type1">Create File</label>
|
||||
<input type="radio" id="type2" name="type" value="folder" />
|
||||
<label for="type2">Create Folder</label>
|
||||
</div>
|
||||
<br />
|
||||
<label for="name">File Name:</label>
|
||||
<input type="text" id="name" name="name" required size="10" />
|
||||
<input
|
||||
id="process_button"
|
||||
id="create_file_button"
|
||||
type="submit"
|
||||
value="Create File"
|
||||
value="Create"
|
||||
class="button primary"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user