refactor: use props

This commit is contained in:
Shivam Mishra 2019-10-24 13:03:56 +05:30
parent ab7c268fce
commit d44e29bc70
3 changed files with 8 additions and 4 deletions

View file

@ -129,6 +129,9 @@ export default {
show_upload_button: {
default: true
},
file_browser_enabled: {
default: true
},
allow_multiple: {
default: true
},
@ -187,9 +190,6 @@ export default {
return this.files.length > 0
&& this.files.every(
file => file.total !== 0 && file.progress === file.total);
},
file_browser_enabled() {
return !Boolean(frappe.web_form)
}
},
methods: {

View file

@ -71,7 +71,6 @@ frappe.ui.form.ControlAttach = frappe.ui.form.ControlData.extend({
if (this.df.options) {
Object.assign(options, this.df.options);
}
this.upload_options = options;
},

View file

@ -111,6 +111,11 @@ frappe.ready(function() {
if (df.fieldtype === "Link") {
df.only_select = true;
}
if (["Attach", "Attach Image"].includes(df.fieldtype)) {
if (!df.options)
df.options = {}
df.options.file_browser_enabled = false;
}
});
return form_data;