From cf333cbbfb71ee51c0f0047e877c75fc19dfc415 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 9 Sep 2015 17:02:35 +0000 Subject: [PATCH] Add ability to select existing file in VFS for custom field type filemanager - Fix missing ID --- etemplate/js/et2_extension_customfields.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etemplate/js/et2_extension_customfields.js b/etemplate/js/et2_extension_customfields.js index d35fd6c74e..1c3bdc2baa 100644 --- a/etemplate/js/et2_extension_customfields.js +++ b/etemplate/js/et2_extension_customfields.js @@ -608,6 +608,13 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput cf = jQuery(document.createElement("td")) .appendTo(row); + // Create upload widget + var widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this); + + // This controls where the widget is placed in the DOM + this.rows[attrs.id] = cf[0]; + $j(widget.getDOMNode(widget)).css('vertical-align','top'); + // Add a link to existing VFS file var select_attrs = jQuery.extend({}, attrs, @@ -625,14 +632,7 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput // Do not store in the widgets list, one name for multiple widgets would cause problems widget = et2_createWidget(select_attrs.type, select_attrs, this); - $j(widget.getDOMNode(widget)).css('vertical-align','top'); - - // Create upload widget - var widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this); - - // This controls where the widget is placed in the DOM - this.rows[attrs.id] = cf[0]; - $j(widget.getDOMNode(widget)).css('vertical-align','top'); + $j(widget.getDOMNode(widget)).css('vertical-align','top').prependTo(cf); } return false; },