Sha256: 1ade26c1d19d30a811f8f67d1e5b26dfc2ed4c2b5034c33c64bb62e3eb0e969a

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

I">(function() {
  var onDOMReady;

  ActiveAdmin.PerPage = (function() {
    function PerPage(options, element) {
      this.options = options;
      this.element = element;
      this.$element = $(this.element);
      this._init();
      this._bind();
    }

    PerPage.prototype._init = function() {
      return this.$params = this._queryParams();
    };

    PerPage.prototype._bind = function() {
      return this.$element.change((function(_this) {
        return function() {
          _this.$params['per_page'] = _this.$element.val();
          delete _this.$params['page'];
          if (typeof Turbolinks !== 'undefined') {
            return Turbolinks.visit(window.location.href.split('?')[0] + '?' + $.param(_this.$params));
          } else {
            return location.search = $.param(_this.$params);
          }
        };
      })(this));
    };

    PerPage.prototype._queryParams = function() {
      var m, params, query, re;
      query = window.location.search.substring(1);
      params = {};
      re = /([^&=]+)=([^&]*)/g;
      while (m = re.exec(query)) {
        params[this._decode(m[1])] = this._decode(m[2]);
      }
      return params;
    };

    PerPage.prototype._decode = function(value) {
      return decodeURIComponent(value.replace(/\+/g, '%20'));
    };

    PerPage.prototype.option = function(key, value) {
      if ($.isPlainObject(key)) {
        return this.options = $.extend(true, this.options, key);
      } else if (key != null) {
        return this.options[key];
      } else {
        return this.options[key] = value;
      }
    };

    return PerPage;

  })();

  $.widget.bridge('perPage', ActiveAdmin.PerPage);

  onDOMReady = function() {
    return $('.pagination_per_page select').perPage();
  };

  $(document).ready(onDOMReady).on('page:load turbolinks:load', onDOMReady);

}).call(this);
:ET

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_admin-workflow-0.1.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/5C/5C2Y5uwZzF7ZyUsr_JmgiDt_2S8hu8WhbSaVutRvclU.cache
activeadmin_latlng-1.5.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/5c/5C2Y5uwZzF7ZyUsr_JmgiDt_2S8hu8WhbSaVutRvclU.cache
activeadmin_latlng-1.4.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/5c/5C2Y5uwZzF7ZyUsr_JmgiDt_2S8hu8WhbSaVutRvclU.cache
activeadmin_latlng-1.3.0 spec/dummy/tmp/cache/assets/sprockets/v3.0/5c/5C2Y5uwZzF7ZyUsr_JmgiDt_2S8hu8WhbSaVutRvclU.cache
activeadmin_latlng-1.2.2 spec/dummy/tmp/cache/assets/sprockets/v3.0/5c/5C2Y5uwZzF7ZyUsr_JmgiDt_2S8hu8WhbSaVutRvclU.cache