Merge pull request #31332 from sokumon/remove-view-file
fix: cleanup view file button
This commit is contained in:
commit
8102706116
1 changed files with 10 additions and 8 deletions
|
|
@ -1,10 +1,15 @@
|
||||||
frappe.ui.form.on("File", {
|
frappe.ui.form.on("File", {
|
||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
frm.add_custom_button(__("View File"), () => {
|
if (frm.doc.file_url) {
|
||||||
if (!frappe.utils.is_url(frm.doc.file_url)) {
|
frm.add_custom_button(__("View File"), () => {
|
||||||
window.open(window.location.origin + frm.doc.file_url);
|
if (!frappe.utils.is_url(frm.doc.file_url)) {
|
||||||
}
|
window.open(window.location.origin + frm.doc.file_url);
|
||||||
});
|
} else {
|
||||||
|
window.open(frm.doc.file_url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!frm.doc.is_folder) {
|
if (!frm.doc.is_folder) {
|
||||||
// add download button
|
// add download button
|
||||||
frm.add_custom_button(__("Download"), () => frm.trigger("download"), "fa fa-download");
|
frm.add_custom_button(__("Download"), () => frm.trigger("download"), "fa fa-download");
|
||||||
|
|
@ -32,9 +37,6 @@ frappe.ui.form.on("File", {
|
||||||
if (frm.doc.file_name && frm.doc.file_name.split(".").splice(-1)[0] === "zip") {
|
if (frm.doc.file_name && frm.doc.file_name.split(".").splice(-1)[0] === "zip") {
|
||||||
frm.add_custom_button(__("Unzip"), () => frm.trigger("unzip"));
|
frm.add_custom_button(__("Unzip"), () => frm.trigger("unzip"));
|
||||||
}
|
}
|
||||||
if (frm.doc.file_url) {
|
|
||||||
frm.add_web_link(frm.doc.file_url, __("View file"));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
preview_file: function (frm) {
|
preview_file: function (frm) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue