[data, status, jqxhr, this.action_data]);
});
}).on('click', '.chooser-show-project', function() {
- $(this).attr('href', '#');
+ var params = {};
+ $(this).attr('href', '#'); // Skip normal click handler
+ if ($(this).attr('data-project-uuid')) {
+ params = {'filters[]': JSON.stringify(['owner_uuid',
+ '=',
+ $(this).attr('data-project-uuid')])};
+ }
+ // Use current selection as dropdown button label
+ $(this).
+ closest('.dropdown-menu').
+ prev('button').
+ 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',
- {'filters[]': JSON.stringify(['owner_uuid', '=', $(this).attr('data-project-uuid')])}).
+ data('infinite-content-params', params).
trigger('refresh-content');
});
$(document).on('page-refresh', function(event, data, status, jqxhr, action_data) {