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.
|
|
|
|
*/
|
|
|
|
$('.subsitestreedropdownfield-chooser').entwine({
|
|
|
|
onchange: function() {
|
|
|
|
// TODO Data binding between two fields
|
|
|
|
// TODO create resetField method on API instead
|
|
|
|
var fields = $('.SubsitesTreeDropdownField');
|
|
|
|
fields.setValue(null);
|
|
|
|
fields.setTitle(null);
|
|
|
|
fields.find('.tree-holder').empty();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add selected subsite from separate dropdown to the request parameters
|
|
|
|
* before asking for the tree.
|
|
|
|
*/
|
|
|
|
$('.TreeDropdownField.SubsitesTreeDropdownField').entwine({
|
2012-07-10 15:43:53 +02:00
|
|
|
getRequestParams: function() {
|
2013-07-10 15:29:22 +02:00
|
|
|
var name = this.find(':input[type=hidden]:first').attr('name') + '_SubsiteID',
|
|
|
|
source = $('[name=' + name + ']'), params = {};
|
|
|
|
params[name] = source.length ? source.val() : null;
|
|
|
|
return params;
|
2013-07-10 12:30:55 +02:00
|
|
|
}
|
2012-07-10 15:43:53 +02:00
|
|
|
});
|
|
|
|
});
|
2013-07-11 07:31:59 +02:00
|
|
|
})(jQuery);
|