Sha256: 1b893815910a7326d77ab6e4cea8d7f006bbc93694ed35dfda027a2ba3df3f78

Contents?: true

Size: 1.03 KB

Versions: 17

Compression:

Stored size: 1.03 KB

Contents

((window, $) => {

  class ActiveAdmin {

    static get turbolinks() {
      return (typeof Turbolinks !== 'undefined' && Turbolinks.supported);
    }

    static turbolinksVisit(params) {
      const path = [window.location.pathname, '?', this.toQueryString(params)].join('')
      Turbolinks.visit(path);
    }

    static queryString() {
      return (window.location.search || '').replace(/^\?/, '');
    }

    static queryStringToParams() {
      const decode = (value) => decodeURIComponent((value || '').replace(/\+/g, '%20'));

      return this.queryString()
        .split("&")
        .map(pair => pair.split("="))
        .map(([key, value]) => {
          return { name: decode(key), value: decode(value) }
        });
    }

    static toQueryString(params) {
      const encode = (value) => encodeURIComponent(value || '');

      return params
        .map(({name, value}) => [ encode(name), encode(value) ])
        .map(pair => pair.join('='))
        .join('&')
    }
  }

  window.activeadmin = ActiveAdmin

})(window, jQuery);

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
activeadmin-rails-1.7.1 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-rails-1.7.0 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.4.0 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.3.1 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.3.0 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.2.0 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.1.0 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.0.0 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.0.0.rc2 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin-2.0.0.rc1 app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/app/assets/javascripts/active_admin/lib/active_admin.es6