Skip to content

Commit

Permalink
onButtonClick: Lookup model props instead of checking for CSS classes
Browse files Browse the repository at this point in the history
  • Loading branch information
swashbuck committed Sep 7, 2023
1 parent 83ae32a commit a3cb053
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions js/PageNavView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ class PageNavView extends ComponentView {

onButtonClick(event) {
const $target = $(event.currentTarget);
const isLocked = $target.hasClass('is-locked');
const isSelected = $target.attr('aria-current');
const index = $target.data('item-index');
const item = this.model.get('_items')[index];

const isLocked = item._isHidden || item._isLocked;
const isSelected = item._isCurrent;
if (isLocked || isSelected) return;

const id = $target.data('id');
this.navigateTo(id);
this.navigateTo(item._id);
};

setupTooltips() {
Expand Down

0 comments on commit a3cb053

Please sign in to comment.