2012-03-25 18:35:01 +02:00
|
|
|
(function($) {
|
2012-07-10 15:43:53 +02:00
|
|
|
$.entwine('ss', function($) {
|
2013-07-10 15:29:22 +02:00
|
|
|
/**
|
|
|
|
* Choose a subsite from which to select pages.
|
|
|
|
* Needs to clear tree dropdowns in case selection is changed.
|
|
|
|
*/
|
2018-01-30 04:21:45 +01:00
|
|
|
$('select.subsitestreedropdownfield-chooser').entwine({
|
2013-07-10 15:29:22 +02:00
|
|
|
onchange: function() {
|
|
|
|
// TODO Data binding between two fields
|
2018-01-30 04:21:45 +01:00
|
|
|
const name = this.attr('name').replace('_SubsiteID', '');
|
|
|
|
let field = $('#Form_EditForm_' + name).first();
|
|
|
|
field.setValue(0);
|
|
|
|
field.refresh();
|
|
|
|
field.trigger('change');
|
2013-07-10 15:29:22 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add selected subsite from separate dropdown to the request parameters
|
|
|
|
* before asking for the tree.
|
|
|
|
*/
|
|
|
|
$('.TreeDropdownField.SubsitesTreeDropdownField').entwine({
|
2018-01-30 04:21:45 +01:00
|
|
|
getAttributes() {
|
|
|
|
const fieldName = this.attr('id').replace('Form_EditForm_', '');
|
|
|
|
const subsiteID = $('#Form_EditForm_' + fieldName + '_SubsiteID option:selected').val();
|
|
|
|
|
|
|
|
let attributes = this._super();
|
|
|
|
attributes.data.urlTree += "?" + fieldName + "_SubsiteID=" + subsiteID;
|
|
|
|
attributes.data.cacheKey = attributes.data.cacheKey.substring(0, 19) + "_" + subsiteID;
|
|
|
|
return attributes;
|
|
|
|
}
|
2012-07-10 15:43:53 +02:00
|
|
|
});
|
|
|
|
});
|
2013-07-11 07:31:59 +02:00
|
|
|
})(jQuery);
|