MDL-33175 - filemanager: make dndupload icon clickable

This commit is contained in:
Dan Poltawski
2012-06-14 13:25:05 +08:00
parent f8dfdb524b
commit bc1f298b2a
+18 -10
View File
@@ -262,16 +262,12 @@ M.form_filemanager.init = function(Y, options) {
var button_addfile = this.filemanager.one('.fp-btn-add');
// setup 'add file' button
// if maxfiles == -1, the no limit
button_addfile.on('click', function(e) {
e.preventDefault();
var options = this.filepicker_options;
options.formcallback = this.filepicker_callback;
// XXX: magic here, to let filepicker use filemanager scope
options.magicscope = this;
options.savepath = this.currentpath;
M.core_filepicker.show(Y, options);
}, this);
button_addfile.on('click', this.show_filepicker, this);
var dndarrow = this.filemanager.one('.dndupload-arrow');
if (dndarrow) {
dndarrow.on('click', this.show_filepicker, this);
}
// setup 'make a folder' button
if (this.options.subdirs) {
@@ -369,6 +365,18 @@ M.form_filemanager.init = function(Y, options) {
}
}, this);
},
show_filepicker: function (e) {
// if maxfiles == -1, the no limit
e.preventDefault();
var options = this.filepicker_options;
options.formcallback = this.filepicker_callback;
// XXX: magic here, to let filepicker use filemanager scope
options.magicscope = this;
options.savepath = this.currentpath;
M.core_filepicker.show(Y, options);
},
print_path: function() {
var p = this.options.path;
this.pathbar.setContent('').addClass('empty');