add upload button

This commit is contained in:
joshuaboud 2021-10-04 14:12:43 -03:00
parent 10a4e91504
commit db98a635b7
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E
2 changed files with 22 additions and 0 deletions

View File

@ -37,6 +37,21 @@ export class NavDragDrop {
this.nav_window_ref = nav_window_ref; this.nav_window_ref = nav_window_ref;
this.modal_prompt = new ModalPrompt(); this.modal_prompt = new ModalPrompt();
this.upload_manager = new FileUploadManager(this.nav_window_ref, 6); this.upload_manager = new FileUploadManager(this.nav_window_ref, 6);
this.upload_element = document.createElement('input');
this.upload_element.type = 'file';
this.upload_element.multiple = true;
this.upload_element.onchange = async e => {
var uploads = []
for (const file of e.target.files) {
let uploader = new FileUpload(file, this.nav_window_ref);
uploader.using_webkit = false;
uploads.push(uploader);
}
uploads = await this.handle_conflicts(uploads);
this.upload_manager.add(... uploads);
this.nav_window_ref.stop_load();
}
document.getElementById("nav-upload-btn").addEventListener("click", this.upload_dialog.bind(this));
} }
/** /**
@ -196,4 +211,9 @@ export class NavDragDrop {
break; break;
} }
} }
upload_dialog() {
this.nav_window_ref.start_load();
this.upload_element.click();
}
} }

View File

@ -64,6 +64,8 @@
<button class="disable-while-loading pf-c-button pf-m-primary" id="nav-touch-btn" title="New File"><i class="fas fa-file-medical"></i></button> <button class="disable-while-loading pf-c-button pf-m-primary" id="nav-touch-btn" title="New File"><i class="fas fa-file-medical"></i></button>
<div class="horizontal-spacer"></div> <div class="horizontal-spacer"></div>
<button class="disable-while-loading pf-c-button pf-m-primary" id="nav-ln-btn" title="New Symbolic Link"><i class="fas fa-link nav-icon-decorated"><i class="fas fa-plus nav-icon-decoration"></i></i></button> <button class="disable-while-loading pf-c-button pf-m-primary" id="nav-ln-btn" title="New Symbolic Link"><i class="fas fa-link nav-icon-decorated"><i class="fas fa-plus nav-icon-decoration"></i></i></button>
<div class="horizontal-spacer"></div>
<button class="disable-while-loading pf-c-button pf-m-primary" id="nav-upload-btn" title="Upload File(s)"><i class="fas fa-upload"></i></button>
</div> </div>
</div> </div>
<div class="vertical-spacer"></div> <div class="vertical-spacer"></div>