var data = [];
var $modal = $(this).closest('.modal');
var action_data = $(this).data('action-data');
+ var action_data_from_params = $(this).data('action-data-from-params');
var selection_param = action_data.selection_param;
$modal.find('.modal-error').removeClass('hide').hide();
$modal.find('.selectable.active[data-object-uuid]').each(function() {
var val = $(this).attr('data-object-uuid');
data.push({name: selection_param, value: val});
});
- $.each(action_data, function(key, value) {
- data.push({name: key, value: value});
- });
+ $.each($.extend({}, action_data, action_data_from_params),
+ function(key, value) {
+ if (value instanceof Array && key[-1] != ']') {
+ for (var i in value) {
+ data.push({name: key + '[]', value: value[i]});
+ }
+ } else {
+ data.push({name: key, value: value});
+ }
+ });
$.ajax($(this).attr('data-action-href'),
{dataType: 'json',
type: $(this).attr('data-method'),
data: data,
- traditional: true,
+ traditional: false,
context: {modal: $modal, action_data: action_data}}).
fail(function(jqxhr, status, error) {
if (jqxhr.readyState == 0 || jqxhr.status == 0) {
});
}).on('click', '.chooser-show-project', function() {
var params = {};
+ var project_uuid = $(this).attr('data-project-uuid');
$(this).attr('href', '#'); // Skip normal click handler
- if ($(this).attr('data-project-uuid')) {
- params = {'filters[]': JSON.stringify(['owner_uuid',
- '=',
- $(this).attr('data-project-uuid')])};
+ if (project_uuid) {
+ params = {'filters': [['owner_uuid',
+ '=',
+ project_uuid]],
+ 'project_uuid': project_uuid
+ };
}
// Use current selection as dropdown button label
$(this).
html($(this).text() + ' <span class="caret"></span>');
// Set (or unset) filter params and refresh filterable rows
$($(this).closest('[data-filterable-target]').attr('data-filterable-target')).
- data('infinite-content-params', params).
+ data('infinite-content-params-from-project-dropdown', params).
trigger('refresh-content');
}).on('ready', function() {
$('form[data-search-modal] a').on('click', function() {