Project

General

Profile

Feature #18555 » fix-the-number-of-alerts.patch

Mizuki ISHIKAWA, 2021-01-12 05:37

View differences:

public/javascripts/attachments.js
29 29

  
30 30
    addAttachment.toggle(attachmentsFields.children().length < maxFiles);
31 31
    return attachmentId;
32
  } else {
33
    alert($('input.file_selector').data('max-number-of-files-message'));
34 32
  }
35 33
  return null;
36 34
}
......
161 159
  var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
162 160

  
163 161
  var sizeExceeded = false;
162
  var filesLength = $(inputEl).closest('.attachments_form').find('.attachments_fields').children().length + files.length
164 163
  $.each(files, function() {
165 164
    if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
166 165
  });
......
169 168
  } else {
170 169
    $.each(files, function() {addFile(inputEl, this, true);});
171 170
  }
171

  
172
  if (filesLength > ($(inputEl).attr('multiple') == 'multiple' ? 10 : 1)) {
173
    window.alert($(inputEl).data('max-number-of-files-message'));
174
  }
172 175
  return sizeExceeded;
173 176
}
174 177

  
(7-7/7)