Sha256: bb388ab68c69c7b4416c4beeab13695e7a981bde2627326e913e4431dd0e6bb9

Contents?: true

Size: 804 Bytes

Versions: 4

Compression:

Stored size: 804 Bytes

Contents

import Component from "@ember/component";
import { computed } from "@ember/object";
import { equal } from "@ember/object/computed";

export default Component.extend({
  classNames: ["nav-controls"],
  classNameBindings: ["extraClasses"],
  disableBackButtons: equal("position", 0),

  disableForwardButtons: computed("position", "list.length", function() {
    return this.position === this.get("list.length") - 1;
  }),

  displayNumber: computed("position", function() {
    return this.position + 1;
  }),

  actions: {
    takeStep(dir) {
      const amount = dir === "back" ? -1 : 1;
      const newPos = this.position + amount;
      this.navigate(newPos);
    },

    bigJump(dir) {
      const newPos = dir === "back" ? 0 : this.get("list.length") - 1;
      this.navigate(newPos);
    }
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logster-2.6.1 client-app/app/components/page-nav.js
logster-2.6.0 client-app/app/components/page-nav.js
logster-2.5.1 client-app/app/components/page-nav.js
logster-2.5.0 client-app/app/components/page-nav.js