mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 11:46:23 +00:00
Upgraded Inventory Search (#15417)
* fix: add search descriptions capability to items and equipment * pet search working for mismatched pairs; mount still in progress * added some comments about current issue to relevant portion of code * search working on pet and mount names (except flying carpet) * update comment text * remove console.log(animals) * add eggkey back in * add mountName as property to animal object, amend filter function
This commit is contained in:
parent
661b30e807
commit
d48e4a664f
4 changed files with 12 additions and 7 deletions
|
|
@ -410,7 +410,8 @@ export default {
|
|||
const ownedItem = this.flatGear[gearKey];
|
||||
|
||||
const isSearched = !searchText
|
||||
|| ownedItem.text().toLowerCase().indexOf(searchText) !== -1;
|
||||
|| ownedItem.text().toLowerCase().indexOf(searchText) !== -1
|
||||
|| ownedItem.notes().toLowerCase().indexOf(searchText) !== -1;
|
||||
|
||||
if (ownedItem.klass !== 'base' && isSearched) {
|
||||
const { type } = ownedItem;
|
||||
|
|
|
|||
|
|
@ -338,9 +338,10 @@ export default {
|
|||
if (itemQuantity > 0 && isAllowed) {
|
||||
const item = contentItems[itemKey];
|
||||
|
||||
const isSearched = !searchText || item.text()
|
||||
.toLowerCase()
|
||||
.indexOf(searchText) !== -1;
|
||||
const isSearched = !searchText
|
||||
|| item.text().toLowerCase().indexOf(searchText) !== -1
|
||||
|| item.notes().toLowerCase().indexOf(searchText) !== -1;
|
||||
|
||||
if (isSearched && item) {
|
||||
itemsArray.push({
|
||||
...item,
|
||||
|
|
|
|||
|
|
@ -627,6 +627,8 @@ export default {
|
|||
animals.push({
|
||||
key: specialKey,
|
||||
eggKey,
|
||||
eggName: text(),
|
||||
mountName: text(),
|
||||
potionKey,
|
||||
name: text(),
|
||||
canFind,
|
||||
|
|
@ -657,7 +659,6 @@ export default {
|
|||
}
|
||||
|
||||
this.cachedAnimalList[key] = animals;
|
||||
|
||||
return animals;
|
||||
},
|
||||
listAnimals (animalGroup, type, hideMissing, sort, searchText) {
|
||||
|
|
@ -670,7 +671,9 @@ export default {
|
|||
}
|
||||
|
||||
if (searchText && searchText !== '') {
|
||||
animals = _filter(animals, a => a.name.toLowerCase().indexOf(searchText) !== -1);
|
||||
animals = _filter(animals, a => a.name.toLowerCase().indexOf(searchText) !== -1
|
||||
|| a.eggName.toLowerCase().indexOf(searchText) !== -1
|
||||
|| a.mountName.toLowerCase().indexOf(searchText) !== -1);
|
||||
}
|
||||
|
||||
// 2. Sort
|
||||
|
|
@ -693,7 +696,6 @@ export default {
|
|||
}
|
||||
|
||||
this.viewOptions[animalGroup.key].animalCount = animals.length;
|
||||
|
||||
return animals;
|
||||
},
|
||||
countOwnedAnimals (animalGroup, type) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export function createAnimal (egg, potion, type, _content, userItems) {
|
|||
imageName: type === 'pet' ? `stable_Pet-${animalKey}` : `stable_Mount_Icon_${animalKey}`,
|
||||
eggKey: egg.key,
|
||||
eggName: getText(egg.text),
|
||||
mountName: getText(egg.mountText),
|
||||
potionKey: potion.key,
|
||||
potionName: getText(potion.text),
|
||||
name: _content[`${type}Info`][animalKey].text(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue