From bc1f298b2a4feeb6be7f595bf32f9a278d2df678 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Thu, 14 Jun 2012 13:24:10 +0800 Subject: [PATCH] MDL-33175 - filemanager: make dndupload icon clickable --- lib/form/filemanager.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index 3b2bd3ea921..3949641b3a7 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -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'); -- 2.43.0