silverstripe-framework/javascript/UploadField_select.js
Mateusz Uzdowski 47e3052aaa ENHANCEMENT: allow folder selection when attaching files from the CMS
http://open.silverstripe.org/ticket/7046
UploadField would default to one folder only, and wouldn't allow asset
tree traversal. HtmlEditorField MediaForm has this capability, so added
it here in a similar fashion via TreeDropdownField.
2012-04-23 12:08:16 +12:00

19 lines
504 B
JavaScript

(function($) {
$.entwine('ss', function($) {
// Install the directory selection handler
$('form.uploadfield-form #ParentID .TreeDropdownField').entwine({
onmatch: function() {
this._super();
var self = this;
this.bind('change', function() {
// Display the contents of the folder in the listing field.
var fileList = self.closest('form').find('.ss-gridfield');
fileList.setState('ParentID', self.getValue());
fileList.reload();
});
}
});
});
})(jQuery);