search by subtype

This commit is contained in:
Daniel
2017-11-18 21:37:13 -05:00
parent fba71558c8
commit c2a57e924a
2 changed files with 19 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -166,6 +166,14 @@ export default class CollectionHome extends React.Component {
baseResultset = baseResultset.find({'gsx$gender': {'$or': genderList} });
}
let subtypesList = stones.subtypes.value.split(/[ ,]+/).filter(Boolean).map((item) => {
return ({'$regex': new RegExp(item, 'i')});
});
console.log(subtypesList);
if (subtypesList.length > 0) {
baseResultset = baseResultset.find({'gsx$types': {'$or': subtypesList} });
}
// Sort data descending alphabetically
let results = baseResultset.simplesort('gsx$name').data();
if (results.length > 0) this.content = results;
@@ -183,6 +191,8 @@ export default class CollectionHome extends React.Component {
<form onSubmit={search}>
<label>Card Name:<input type="text" ref={(input) => stones.name = input} /></label>
<br /><br />
<label>Subtypes:<input type="text" ref={(input) => stones.subtypes = input} /></label>
<br /><br />
<div>
<input type="checkbox" ref={(input) => tribes.danian = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/danian.png"} />&nbsp;
<input type="checkbox" ref={(input) => tribes.mipedian = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/mipedian.png"} />&nbsp;