Skip to content

Commit

Permalink
fix: grid view item selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Jan 27, 2025
1 parent 0662371 commit f541503
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/javascript/js/controllers/item_selector_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ export default class extends Controller {

ids.push(this.resourceId)

// Mark the row as selected
this.element.closest('tr').classList.add('selected-row')
// Mark the row as selected if on table view
if (this.element.closest('tr')) {
this.element.closest('tr').classList.add('selected-row')
}

this.currentIds = ids
}

removeFromSelected() {
// Un-mark the row as selected
this.element.closest('tr').classList.remove('selected-row')
// Un-mark the row as selected if on table view
if (this.element.closest('tr')) {
this.element.closest('tr').classList.remove('selected-row')
}

this.currentIds = this.currentIds.filter(
(item) => item.toString() !== this.resourceId,
Expand Down

0 comments on commit f541503

Please sign in to comment.