Sha256: 0bd36da347817a4cc336fd7c1a3093cb438dbebe506c7e9528e23921d3c7bca0

Contents?: true

Size: 597 Bytes

Versions: 26

Compression:

Stored size: 597 Bytes

Contents

import { Controller } from "@hotwired/stimulus";

export default class PagyNavController extends Controller {
  connect() {
    document.addEventListener("shortcut:page-prev", this.prevPage);
    document.addEventListener("shortcut:page-next", this.nextPage);
  }

  disconnect() {
    document.removeEventListener("shortcut:page-prev", this.prevPage);
    document.removeEventListener("shortcut:page-next", this.nextPage);
  }

  nextPage = () => {
    this.element.querySelector("a:last-child").click();
  };

  prevPage = () => {
    this.element.querySelector("a:first-child").click();
  };
}

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
katalyst-koi-4.14.1 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.14.0 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.13.2 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.13.0 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.6 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.5 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.4 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.3 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.2 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.1 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.12.0 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.11.2 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.11.1 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.11.0 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.10.3 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.10.2 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.10.1 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.10.0 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.9.5 app/assets/javascripts/koi/controllers/pagy_nav_controller.js
katalyst-koi-4.9.4 app/assets/javascripts/koi/controllers/pagy_nav_controller.js