Merge pull request #13619 from gavindsouza/hide-attachment-cond-dev

fix: Hide "Attach File" in form if max limit reached
This commit is contained in:
gavin 2021-07-01 17:07:19 +05:30 committed by GitHub
commit 3e92cf2f0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,7 @@ frappe.ui.form.Attachments = class Attachments {
this.parent.find(".add-attachment-btn").click(function() {
me.new_attachment();
});
this.add_attachment_wrapper = this.parent.find(".add_attachment").parent();
this.add_attachment_wrapper = this.parent.find(".add-attachment-btn");
this.attachments_label = this.parent.find(".attachments-label");
}
max_reached(raise_exception=false) {
@ -39,7 +39,7 @@ frappe.ui.form.Attachments = class Attachments {
this.parent.find(".attachment-row").remove();
var max_reached = this.max_reached();
this.add_attachment_wrapper.toggleClass("hide", !max_reached);
this.add_attachment_wrapper.toggle(!max_reached);
// add attachment objects
var attachments = this.get_attachments();