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