Skip to content

Commit 544c0ba

Browse files
Merge pull request #1156 from projectblacklight/remove-that
Remove unnecessary 'that'
2 parents 2e43e05 + cfbe5e2 commit 544c0ba

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

app/assets/javascripts/arclight/context_navigation.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class ContextNavigation {
133133
}
134134

135135
getData() {
136-
const that = this;
137136
// Add a placeholder so flashes of text are not as significant
138137
const placeholder = new Placeholder();
139138
this.el.after(placeholder.$el);
@@ -149,7 +148,7 @@ class ContextNavigation {
149148
original_document: this.originalDocument,
150149
view: 'collection_context'
151150
}
152-
}).done((response) => that.updateView(response));
151+
}).done((response) => this.updateView(response));
153152
}
154153

155154
/**
@@ -212,7 +211,6 @@ class ContextNavigation {
212211
* each resulting Solr Document
213212
*/
214213
updateParents(newDocs) {
215-
const that = this;
216214
// Case where this is a parent list and needs to be filed correctly
217215
//
218216
// Otherwise, retrieve the parent...
@@ -260,9 +258,9 @@ class ContextNavigation {
260258
this.el.html(this.ul);
261259

262260
// Initialize additional things
263-
$itemDoc.find('.context-navigator').each(function (i, e) {
261+
$itemDoc.find('.context-navigator').each((i, e) => {
264262
const contextNavigation = new ContextNavigation(
265-
e, that.originalParents, that.originalDocument
263+
e, this.originalParents, this.originalDocument
266264
);
267265
contextNavigation.getData();
268266
});
@@ -277,7 +275,6 @@ class ContextNavigation {
277275
* @param {string} response - the AJAX response body
278276
*/
279277
updateView(response) {
280-
const that = this;
281278
var resp = $.parseHTML(response);
282279
var $doc = $(resp);
283280
var newDocs = $doc.find('#documents')
@@ -286,8 +283,8 @@ class ContextNavigation {
286283

287284
// See if the original document is located in the returned documents
288285
const originalDocumentIndex = newDocs
289-
.findIndex(doc => doc.id === that.originalDocument);
290-
that.parentLi.find('.al-hierarchy-placeholder').remove();
286+
.findIndex(doc => doc.id === this.originalDocument);
287+
this.parentLi.find('.al-hierarchy-placeholder').remove();
291288

292289
// If the original document in the results, update it. If not update with a
293290
// more complex procedure
@@ -296,9 +293,9 @@ class ContextNavigation {
296293
} else {
297294
this.updateParents(
298295
newDocs,
299-
that.data.arclight.originalParents,
300-
that.data.arclight.parent,
301-
that.parentLi
296+
this.data.arclight.originalParents,
297+
this.data.arclight.parent,
298+
this.parentLi
302299
);
303300
}
304301
this.el.parent().data('resolved', true);
@@ -318,7 +315,6 @@ class ContextNavigation {
318315
}
319316

320317
addListenersForPlusMinus() {
321-
const that = this;
322318
this.ul.find('.al-toggle-view-children').on('click', (e) => {
323319
e.preventDefault();
324320
const targetArea = $($(e.currentTarget).attr('href'));
@@ -328,7 +324,7 @@ class ContextNavigation {
328324
// Send null for originalParents. We want to disregard the original
329325
// component's ancestor trail and instead use the current ID as the
330326
// parent in the query to populate the navigator.
331-
ee, null, that.originalDocument
327+
ee, null, this.originalDocument
332328
);
333329
contextNavigation.getData();
334330
});

0 commit comments

Comments
 (0)