MDL-34221 Filepicker - disableIf now prevents drag and drop upload
This commit is contained in:
committed by
Marina Glancy
parent
3294034b80
commit
b1c669a711
@@ -165,11 +165,22 @@ M.form_dndupload.init = function(Y, options) {
|
||||
this.Y.on('dragleave', this.drag_leave_page, 'body', this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the filemanager / filepicker is disabled
|
||||
* @return bool - true if disabled
|
||||
*/
|
||||
is_disabled: function() {
|
||||
return this.container.hasClass('disabled');
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the 'drop files here' message when file(s) are dragged
|
||||
* onto the page
|
||||
*/
|
||||
drag_enter_page: function(e) {
|
||||
if (this.is_disabled()) {
|
||||
return false;
|
||||
}
|
||||
if (!this.has_files(e)) {
|
||||
return false;
|
||||
}
|
||||
@@ -210,6 +221,9 @@ M.form_dndupload.init = function(Y, options) {
|
||||
* @return boolean true if a valid file drag event
|
||||
*/
|
||||
check_drag: function(e) {
|
||||
if (this.is_disabled()) {
|
||||
return false;
|
||||
}
|
||||
if (!this.has_files(e)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -211,10 +211,14 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
|
||||
if (this.getAttribute('class') == 'filepickerhidden'){
|
||||
var pickerbuttons = form.elementsByName(name + 'choose');
|
||||
pickerbuttons.each(function(){
|
||||
var clientid = this.get('id').split('-')[2];
|
||||
var filepicker = Y.one('#file_info_'+clientid);
|
||||
if (disabled){
|
||||
this.setAttribute('disabled','disabled');
|
||||
filepicker.addClass('disabled');
|
||||
} else {
|
||||
this.removeAttribute('disabled');
|
||||
filepicker.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -326,6 +326,8 @@ a.ygtvspacer:hover {color: transparent;text-decoration: none;}
|
||||
/*
|
||||
* Drag and drop support (File Manager only)
|
||||
*/
|
||||
.filepicker-filelist.disabled {background-color:#ddd;}
|
||||
.filepicker-filelist.disabled .filepicker-filename {display:none;}
|
||||
.filepicker-filelist .filepicker-container,
|
||||
.filemanager.fm-noitems .fm-empty-container {display:block;position:absolute;top:10px;bottom:10px;left:10px;right:10px;border: 2px dashed #BBBBBB;padding-top:85px;text-align:center;z-index: 3000;}
|
||||
.filepicker-filelist .dndupload-target,
|
||||
|
||||
Reference in New Issue
Block a user