Skip to content

Commit 14c7aa3

Browse files
committed
remove comments
1 parent cd1ea60 commit 14c7aa3

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

app/javascript/controllers/multiple_select_controller.js

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Controller } from '@hotwired/stimulus'
22
import TomSelect from 'tom-select'
33

44
export default class extends Controller {
5-
static targets = ['select', 'option', 'item', 'hiddenItem', 'showAllOption'] // add 'selectAllBtn' if going with button
5+
static targets = ['select', 'option', 'item', 'hiddenItem', 'showAllOption']
66
static values = {
77
options: Array,
88
selectedItems: Array,
@@ -60,17 +60,9 @@ export default class extends Controller {
6060
? [{ text: 'Select/Unseselect all', subtext: '', value: ' ', group: '' }].concat(this.optionsValue)
6161
: this.optionsValue
6262

63-
// const selectAllBtn = this.selectAllBtnTarget
64-
// assign TomSelect instance to this.selectEl if going with button implementation
65-
6663
/* eslint-disable no-new */
6764
new TomSelect(this.selectTarget, {
68-
onItemRemove: function (value, data) {
69-
// for the select/unselect all button - add in short circuit in case showAllBtn doesn't exist
70-
// if (this.items.length < orderedOptionVals.length) {
71-
// selectAllBtn.innerText = 'Select all'
72-
// }
73-
65+
onItemRemove: function (value) {
7466
if (value === ' ') {
7567
this.clear()
7668
}
@@ -79,11 +71,6 @@ export default class extends Controller {
7971
this.setTextboxValue('')
8072
this.refreshOptions()
8173

82-
// for the select/unselect all button - add in short circuit in case showAllBtn doesn't exist
83-
// if (this.items.length < orderedOptionVals.length) {
84-
// selectAllBtn.innerText = 'Select all'
85-
// }
86-
8774
if (value === ' ') {
8875
this.addItems(orderedOptionVals)
8976
}
@@ -122,19 +109,4 @@ export default class extends Controller {
122109
}
123110
})
124111
}
125-
126-
// action for the select/unselect all button - add in short circuit in case showAllBtn or selectEl doesn't exist
127-
// toggleSelectAll() {
128-
// if (!this.selectEl || !this.selectAllBtnTarget) return
129-
130-
// const checkedStatus = this.selectEl.items.length === Object.keys(this.selectEl.options).length ? "all" : "not-all"
131-
132-
// if (checkedStatus === "all") {
133-
// this.selectEl.clear()
134-
// this.selectAllBtnTarget.textContent = "Select all"
135-
// } else {
136-
// this.selectEl.addItems(this.optionsValue.map(opt => opt.value))
137-
// this.selectAllBtnTarget.textContent = "Unselect all"
138-
// }
139-
// }
140112
}

0 commit comments

Comments
 (0)