MCPcopy Create free account
hub / github.com/codecombat/codecombat / runSearch

Method runSearch

app/views/common/SearchView.js:95–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93 }
94
95 runSearch () {
96 if (this.destroyed) { return }
97 const term = this.$el.find('input#search').val()
98 if (this.sameSearch(term)) { return }
99 this.removeOldSearch()
100
101 const options = {
102 queryParams: this.queryParams,
103 }
104 this.collection = new SearchCollection(this.modelURL, this.model, term, this.projection, this.limit, options)
105 this.collection.term = term // needed?
106 if (!this.archived) {
107 this.collection.url += '&archived=false'
108 }
109 this.listenTo(this.collection, 'sync', this.onSearchChange)
110 this.showLoading(this.$el.find('.results'))
111
112 this.updateHash(term)
113 return this.collection.fetch()
114 }
115
116 updateHash (term) {
117 const newPath = document.location.pathname + (term ? '#' + term : '')

Callers

nothing calls this directly

Calls 5

sameSearchMethod · 0.95
removeOldSearchMethod · 0.95
updateHashMethod · 0.95
showLoadingMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected