Sha256: c5e53d4b9b4df241de3250e724c68dbb17a483108f258e086e012fc19ff5ffc4
Contents?: true
Size: 1.08 KB
Versions: 17
Compression:
Stored size: 1.08 KB
Contents
(($, ActiveAdmin) => { class PerPage { constructor(element) { this.element = element; } update() { const params = ActiveAdmin .queryStringToParams() .filter(({name}) => name != 'per_page' || name != 'page') params.push({ name: 'per_page', value: this.element.value }); if (ActiveAdmin.turbolinks) { ActiveAdmin.turbolinksVisit(params); } else { window.location.search = ActiveAdmin.toQueryString(params); } } static _jQueryInterface(config) { return this.each(function () { const $this = $(this) let data = $this.data('perPage') if (!data) { data = new PerPage(this) $this.data('perPage', data) } if (config === 'update') { data[config]() } }) } }; $(document). on('change', '.pagination_per_page > select', function(event) { PerPage._jQueryInterface.call($(this), 'update') }); $.fn['perPage'] = PerPage._jQueryInterface $.fn['perPage'].Constructor = PerPage })(jQuery, window.activeadmin);
Version data entries
17 entries across 17 versions & 3 rubygems