fix: attach image modal for tour

This commit is contained in:
Jannat Patel 2021-11-23 17:36:08 +05:30
parent aede12d8b7
commit f947fb9cf2

View file

@ -68,7 +68,7 @@ frappe.ui.form.FormTour = class FormTour {
if (step.fieldtype == 'Table') this.handle_table_step(step);
if (step.is_table_field) this.handle_child_table_step(step);
//if (step.fieldtype == 'Attach Image') this.handle_attach_image_steps(step);
if (step.fieldtype == 'Attach Image') this.handle_attach_image_steps(step);
});
if (this.tour.save_on_complete) {
@ -243,7 +243,6 @@ frappe.ui.form.FormTour = class FormTour {
}
add_step_to_save() {
console.log("save")
const page_id = `[id="page-${this.frm.doctype}"]`;
const $save_btn = `${page_id} .standard-actions .primary-action`;
const save_step = {
@ -267,10 +266,8 @@ frappe.ui.form.FormTour = class FormTour {
handle_attach_image_steps() {
$('.btn-attach').one('click', () => {
frappe.utils.sleep(300)
setTimeout(() => {
const modal_element = $(".file-uploader").closest(".modal-content");
modal_element.css("z-index", "1000004 !important");
const attach_dialog_step = {
element: modal_element[0],
allowClose: false,
@ -285,13 +282,14 @@ frappe.ui.form.FormTour = class FormTour {
this.driver_steps.splice(this.driver.currentStep + 1, 0, attach_dialog_step);
this.update_driver_steps(); // need to define again, since driver.js only considers steps which are inside DOM
frappe.utils.sleep(300).then(() => this.driver.start(this.driver.currentStep + 1));
console.log('click', this.driver_steps)
}, 1000);
modal_element.on('hidden.bs.modal', () => {
this.driver.moveNext();
})
})
this.driver.overlay.refresh();
modal_element.closest('.modal').on('hidden.bs.modal', () => {
this.driver.moveNext();
});
}, 500);
});
}
};