From 378a11f8413ec6ed7909ca6801644d0b50426e3d Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 18 Sep 2014 18:56:43 +0000 Subject: [PATCH] Also accept file names to remove. --- etemplate/js/et2_widget_file.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_widget_file.js b/etemplate/js/et2_widget_file.js index 32d3801b51..0ea297aa36 100644 --- a/etemplate/js/et2_widget_file.js +++ b/etemplate/js/et2_widget_file.js @@ -558,10 +558,16 @@ var et2_file = et2_inputWidget.extend( /** * Remove a file from the list of values + * + * @param {File|string} File object, or file name, to remove */ remove_file: function(file) { //console.info(filename); + if(typeof file == 'string') + { + file = {fileName: file}; + } for(var key in this.options.value) { if(this.options.value[key].name == file.fileName) @@ -571,7 +577,7 @@ var et2_file = et2_inputWidget.extend( return; } } - if(!file.isComplete()) file.cancel(); + if(file.isComplete && !file.isComplete() && file.cancel) file.cancel(); }, /**